A89: Re: Memory Indirect Postindexed [Addressing] Mode


[Prev][Next][Index][Thread]

A89: Re: Memory Indirect Postindexed [Addressing] Mode




The syntax is ([bd,An],Xn.SIZE*SCALE,od), as you pointed out.

First, the value of An is added to the sign extended base displacement (bd)
value you supply. This yields the intermediate address, which is then used
to fetch a double word from that position in memory.
Next, that value is added to value of the index register you supply
(Xn.SIZE*SCALE) (SIZE is b, w, l.  SCALE can be ignored for our purposes, as
the M68000 does not support it.) Also added to this growing sum is the sign
extended outer displacement value supplied (od).
This value is then used to point to a location in memory from which the
actual instruction operand value is fetched.


Therefore, if A0=#$FFF100, and D1=#$FFF100
and ($FFF120)=#$100
Then ([#$20,A0],D1,#$40) will reference $FFF240 for the purposes of the
instruction it is using.

Of course, this is all just going from the diagrams in the book and the
accompaning text.  I have NOT tested this addressing mode, so am not 100%
certain it does what I say it does.

--kaus




----- Original Message -----
From: "Scott Noveck" <noveck@pluto.njcc.com>
To: <assembly-89@lists.ticalc.org>
Sent: Saturday, April 15, 2000 9:45 PM
Subject: A89: Memory Indirect Postindexed [Addressing] Mode


>
> Here's a question for anyone who _really_ knows their 68k well.  I
guarantee
> it'll confuse the heck outta everyone here.
>
> How do you use "Memory Indirect Postindexed [Addressing] Mode"???  The
> motorola syntax is:
>
> ([bd,An],Xn.SIZE*SCALE,od)    [all 4 user-specified values are optional]
>
> which can be found on page 2-11 of the Programmer's Reference Manual,
along
> with a load of motorola technical terms and a pretty flowchart.  It
appears
> to use two levels of indirection, although I can't find any realistic use
> for it (maybe a C compiler can?)
>
> oh, and get this - it allows for up to FIVE extension words, or a single
> instruction of MORE THAN 12 BYTES!
>
> if you use 'bsr routine' with this code, I THINK it should put $FFFFFFFF
in
> d1.  I'm not sure if it assembles, but it seems to fit what the book says.
> Can someone tell me if this would work, or, if not, what the hell this
> addressing mode does and why it exists?
>
> routine:                        ;all this should just be "st d1"
>  move.l d0,-(a7)                ;save d0
>  lea label1,a0                  ;base memory address
>  move.l #2,d0                   ;number of [words] to be added later
>  move.l (4,a0,d0.l,4),d1        ;first operand should be (label3) =
> $FFFFFFFF
>  move.l (a7)+,d0                ;restore d0
>  rts                            ;return
>
> label1:
>   dc.l 0
>   dc.l label2                   ;label1 + 4
>
> label2:
>  dc.l 0
>  dc.l 0
>  dc.l 0                         ;label2 + (2 * 2)
>  dc.l label3                    ;label2 + (2 * 2) + 4
>
> label3:
>  dc.l $FFFFFFFF
>
>
>     -Scott
>
>




References: