cancel
Showing results for 
Search instead for 
Did you mean: 

Pointer indirect long addressing mode not very useful?

Philipp Krause
Senior II
Posted on September 03, 2013 at 12:25

Yesterday I had a look at the pointer indirect long addressing mode. It seems this one is useful only when register X is in use for other purposes:

Loading into a:

ldw x, $5000

ld a, (x)

vs

ld a, (($5000)

Both have a code size of 4 bytes, and the former takes 3 cycles while the latter takes 4 cycles.

ldw x, $5000

ldw x, (x)

vs.

ldw x, (($5000))

Both have a code size of 4 bytes,the former takes 4 cycles, the latter takes 5 cycles.

ldw y, $5000

ldw (y), x

vs

ldw (($5000), x

Here the former takes 6 bytes of code size and 4 cycles, while the latter takes 4 bytes of code size and 5 cycles.

Some are completly pointless:

ldw x, $5000

ldw x, (x)

vs.

ldw x, (($5000))

Both take 4 bytes of code size, but the former takes 4 cycles, while the latter takes 5! And here we overwrite x anyway.

It seems to me that pointer indirect long addressing mode is useful only in very specific circumstances, and I wonder why it was included at all.

Am I missing something about this addressing mode?

Philipp

1 REPLY 1
fggnrc2
Associate II
Posted on September 03, 2013 at 13:16

I think that this addressing mode exists for compability with ST7 code.

It's less useful than the corresponding ST7 addressing mode because X register is 16 bit wide, whereas ST7 X register is only 8 bit wide.

This ''small'' X register feature makes a big difference!