On Sep 10, 2010, at 00:53, robin wrote: > From: "Paul Gilmartin" <paulgboul...@aim.com> > Sent: Thursday, 9 September 2010 4:32 PM > >> I would firmly oppose such a gentle correction. Take a broad view. >> Which has the more obvious meaning: >> >> LA R3,-4(R2) Set R3 to 4 less than R2 > > It doesn't. > It sums 4092 and the content of R2. > If the content of R2 is positive, the sum is larger than the original content > of R2 by 4092.* > If the content of R2 is negative, its value is increased by 4096. > However, if the intermediate sum were negative, the value being > deposited in R3 [being truncated to 24 bits) would become a large positive > value. > In all cases, R3 becomes larger than R2. > [I'm assuming that you meant to write LA R3,-4(0,R2) ] > I did not. As I expanded a few hours later, in a SYSPRINT excerpt:
R:1 FFF000 2 USING -4096,R1 000000 4132 1FFC FFFFFC 3 LA R3,-4(R2) The assembler observes there is a USING that allows resolution of the coded address, -4, and generates an instruction which adds: 4092 The resolved displacement -4096 From R1, the resolved base (R2) Specified in the instruction Setting R3 to 4 less than R2 (modulo address range, as the hardware always operates). > [* The resultant sum must not exceed 24 bits, of course in classic > base-displacement addressing.] > or 31 in neoclassic. The value is stored modulo that address range; the condition code is not set; no exception is taken. If the initial content of R2 is less than 4, R3 may be set to a large positive number. If the initial content of R2 is outside address range, R3 may be set to far less than (R2)-4, always correctly modulo address range. This is the way the address generation hardware has operated from s/360 onward. >> or: >> >> LA R3,4092(R1,R2) Set R3 to 4 less than R2 > > It doesn't either [viz, set R3 to 4 less than R2]. > It sums the contents of Reg 1 and Reg 2 and the displacement value 4092. > You deleted the context. R1 was loaded with -4096. >> ? The first hardly needs the comment to show the programmer's >> intention, > > What the first comment does is to show the reader that the programmer > made a programming error. > The assembler discreetly refrains from making guesses concerning the programmer's intention. > It's the same for the second LA, where the programmer has made two > erroneous assertions. If you're referring to "LA R3,-4(,R2)" or "LA R3,-4(0,R2)", agreed. I made a coding error which the assembler should have reported but failed to. -- gil