Hello all,
I'm looking for a piece of information that I can't seem to find anywhere, therefore must be blatantly obvious and I'm missing it.
When using indexed addressing modes, is the index interpreted as signed or unsigned? (ie if I have the address $2000 and the index in the X register is $80, will the affected address be $2080 or $1F80?
Documentation specifically mentions the offset in the relative addressing mode as being signed, but says nothing about the index in an indexed mode.
Thanks,
-Nick
indexed addressing modes - signed?
for 6502 and 65C02 architecture
The absolute indexed address modes are unsigned.
$2000, x where x is $90 = $2090
$20F0, x where x = $90 = $2180
The zero page indexed modes are also unsigned, but will be truncated into zero page even if the sum exceeds $FF.
$F0, x where x is $20 = $10 ($F0+$20=$110, then AND with $0FF for result)
Zero page indirect indexed will also be unsigned and truncated to zero page for the pointer value.
Daryl
The absolute indexed address modes are unsigned.
$2000, x where x is $90 = $2090
$20F0, x where x = $90 = $2180
The zero page indexed modes are also unsigned, but will be truncated into zero page even if the sum exceeds $FF.
$F0, x where x is $20 = $10 ($F0+$20=$110, then AND with $0FF for result)
Zero page indirect indexed will also be unsigned and truncated to zero page for the pointer value.
Daryl
Last edited by 8BIT on Sat Sep 20, 2008 10:59 pm, edited 1 time in total.
Quote:
Zero page indirect indexed will also be unsigned and truncated to zero page for the pointer value.
However, the 65816 in native-mode behaves differently, if memory serves me correctly. Since direct-page can now float freely anywhere in bank 0, I believe that if X=$F0 and you access $F0,X, you will actually access location (D+$1E0) & 0xFFFF, where D is the current address stored in the direct page register.
So, for the benefit of folks reading this forum, particularly those new to the "Terbium" architecture, it would be most helpful to qualify which CPUs you're asking about.
you can fake it
Perhaps it's obvious (although, I didn't think of it) but it may be worth
noting that since subtaction is just addition you can negate your
base/index and structure your table accordingly to achieve a
similar result, as is done in the fast quarter-square multiply.
(attributed to George Taylor)
noting that since subtaction is just addition you can negate your
base/index and structure your table accordingly to achieve a
similar result, as is done in the fast quarter-square multiply.
(attributed to George Taylor)