On Sep 8, 2010, at 15:14, Tony Harminc wrote:

> On 8 September 2010 15:09, Tom Marchant <[email protected]> wrote:
>> On Wed, 8 Sep 2010 08:35:42 -0600, Paul Gilmartin wrote:
>>
>>> On Sep 8, 2010, at 05:39, robin wrote:
>>>>
>>>> Classic base-displacement atithmetic is always addition,
>>>> never subtraction.
>>>
>>> Ahem.
>>>
>>>        LH    R1,=H'-4096'
>>>        USING -4096,R1
>>>        LA    R2,*
>>>        LA    R3,-4(,R2)
>>>
>>> What does R3 now address?
>>
>> I'm surprised that this would assemble.
>>
>>              R:F  00000          20          USING TEST5,R15
>>                                  21 *
>> 0000 4810 F010            00010    22          LH    R1,=H'-4096'
>>              R:1 FFF000          23          USING -4096,R1
>> 0004 4120 F004            00004    24          LA    R2,*
>> 0008 4130 2FFC           FFFFFC    25          LA    R3,-4(,R2)
>>                                  26 *
>> 0010                               27          LTORG
>> 0010 F000                          28                =H'-4096'
>>
>> I don't understand why the instruction at line 25 assembles
>> as 4130 2FFC.  As far as I can see, it should generate an error.
>
> I don't understand it either. Almost certainly what Paul meant to write was:
>
>         LA    R3,-4(R2)
>
> which would generate
>
> 41321FFC
>
My bad.  Thanks for the correction.  And apologies to Tom, who
was particularly misled by my carelessness.  It was unintentional.

The page that Michael cited:

    http://www.kcats.org/csci/464/ho/usingtechnique.shtml

appears to be (partly) in response to a thread I started on
this list years ago.  Still, I agree with John, Tony, and bixoft,
and disagree with Robin and Binyamin.

In my memory, this went by so many years ago that LHI and AHI
were not available.  Nowadays, AHI might be a better choice.
However, availability of a (perhaps) better alternative does
not diminish the truth of Tony's assertion, "It's also how
'classic' (base & displacement) addressing arithmetic, which
we all know deals only with unsigned values, can subtract."

-- gil

Reply via email to