On Nov 24, 2011, at 15:49, John Gilmore wrote:

> What's past is prologue.  There are historic reasons why, for example,
>
> |&termc    setc  '-201'
> |&terma    seta  &termc
>
> sets &terma NOT to  arithmetic -201 but to arithmetic +201.  If you
> want to preserve algebraic values you must use the D2A and A2D bifs or
> RYO.  This is counter-intuitive if you do not know the history, but
> low-level changes in the behavior of the HLASM to make it more
> 'reasonable' would break many, a great many, existing routines.
>
And yet I wonder about the history.  Pure speculation, but it's marginally
plausible that during design, there was some emulation and cross-development,
before availability of real s/360 hardware on 709/7090/7094 systems.
These all used sign-magnitude representation in their arithmetic registers,
but twos-complement in index registers (well, actually unsigned modulo
2^15).  A consequence was that in FORTRAN, if the programmer used a
negative value as a subscript, no error was reported, but the magnitude
would be loaded into an index register.  It's possible that a cross-
assembler on the 7094 could exhibit similar behavior converting from
36-bit native to 32-bit target representation, and that that could have
become institutionalized so early to plague us to this day.

Have I seen this misbehavior elsewhere in HLASM?

-- gil

Reply via email to