Paul Gilmartin <[email protected]> wrote:
> Me too.  A comparison:
>
> Assembler H:
>
>                                                                               
>                                   PAGE    2
>    LOC  OBJECT CODE    ADDR1 ADDR2  STMT   SOURCE STATEMENT                   
>                   ASM H V 02 10.13 09/09/10
> 000000                                1 NEGDISP  CSECT
>                           FFFFF000     2          USING -4096,R1
> 000000 4132 1FFC           FFFFFC     3          LA    R3,-4(R2)
>                                        4 *
> 000004 0000 0000            00000     5          LA    R3,-4(,R2)
>     IEV034  *** ERROR ***  ADDRESSABILITY ERROR
>                                        6 *
>                                        7          YREGS
>
> HLASM:
>
>                                                                               
>                                   Page    3
>    Active Usings: None
>    Loc  Object Code    Addr1 Addr2  Stmt   Source Statement                   
>                HLASM R6.0  2010/09/09 10.14
> 000000                00000 00008     1 NEGDISP  CSECT
>                   R:1 FFF000           2          USING -4096,R1
> 000000 4132 1FFC           FFFFFC     3          LA    R3,-4(R2)
>                                        4 *
> 000004 4130 2FFC           FFFFFC     5          LA    R3,-4(,R2)
>                                        6 *
>                                        7          YREGS
>
> Tachyon:
>
>                                                                               
>                                   PAGE    5
>    Active USINGs: None
>
>    Loc  Object Code    Addr1 Addr2  Stmt   Source Statement                   
>               X390 2.3.05  2010/09/09 10.11
>
> 000000                00000 00008     1 NEGDISP  CSECT
> 000000                                2          USING -4096,R1
> ** TXA111E Operand 1 is invalid.
> ** TXA301I Record 2 in .m1/src_Rolltest/NEGDISP.s
> 000000                      FFFFC     3          LA    R3,-4(R2)
> ** TXA317E Addressability error in operand 2.
> ** TXA301I Record 3 in .m1/src_Rolltest/NEGDISP.s
>                                        4 *
> 000004                      FFFFC     5          LA    R3,-4(,R2)
> ** TXA316E Invalid displacement in operand 2.
> ** TXA301I Record 5 in .m1/src_Rolltest/NEGDISP.s
>                                        6 *
>                                        7          YREGS
>
> In my view, the only correct one is Assembler H.
>
> -- gil
>


And, to add to the list, here's what DASM generates:

                   DASM V1.85.05 2010/09/09 13:54
00000000                00000000 00000008      1 NEGDISP  CSECT
                                               2          USING -4096,R1
** DASM305E Operand 1 does not refer to location within reference control 
section
** DASM435I Record 2 in negdisp.asm
00000000 0000 0000               00000000      3          LA    R3,-4(R2)
** DASM028E Invalid displacement
** DASM435I Record 3 in negdisp.asm
00000004 0000 0000               00000000      4          LA    R3,-4(,R2)
** DASM028E Invalid displacement
** DASM435I Record 4 in negdisp.asm


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...

Furthermore, this same document describes the valid
values used for displacements in an "Explicit Address"
(see page 85), where it says:

 Explicit address:

   An explicit address is specified by coding two absolute
   expressions as follows:

     *  The first is an absolute expression for the
        displacement, whose value must lie in the range 0
        through 4095 (4095 is the maximum value that can be
        represented by the 12 binary bits available for the
        displacement in the object code), or in the range
        -524,288 to 524,287 for long-displacement
        instructions.

        ...

and, -4 is not in the range 0 through 4095.
Even if you assume the assembler is simply
wrapping-around and treating -4 as X'FFFFFFFC',
X'FFFFFFFC' is not in the range 0 through 4095
either.

So - I think an argument can be made that both
Tachyon and Dignus are correct in diagnosing
a displacement of '-4' as being invalid.

Or, perhaps, the HLASM documentation needs to
be updated?

        - Dave Rivers -

--
[email protected]                        Work: (919) 676-0847
Get your mainframe programming tools at http://www.dignus.com

Reply via email to