6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sat Nov 23, 2024 5:08 pm

All times are UTC




Post new topic Reply to topic  [ 7 posts ] 
Author Message
PostPosted: Sat Sep 20, 2008 7:45 pm 
Offline

Joined: Sat Sep 20, 2008 7:23 pm
Posts: 4
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


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat Sep 20, 2008 8:17 pm 
Offline
User avatar

Joined: Fri Aug 30, 2002 9:02 pm
Posts: 1748
Location: Sacramento, CA
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


Last edited by 8BIT on Sat Sep 20, 2008 10:59 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat Sep 20, 2008 8:53 pm 
Offline

Joined: Sat Jan 04, 2003 10:03 pm
Posts: 1706
Quote:
Zero page indirect indexed will also be unsigned and truncated to zero page for the pointer value.


This definitely is true for the 6502.

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.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat Sep 20, 2008 9:51 pm 
Offline

Joined: Sat Sep 20, 2008 7:23 pm
Posts: 4
That's exactly what I needed--thanks!


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat Sep 20, 2008 11:00 pm 
Offline
User avatar

Joined: Fri Aug 30, 2002 9:02 pm
Posts: 1748
Location: Sacramento, CA
kc5tja wrote:
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.


My original response has been corrected.


Top
 Profile  
Reply with quote  
 Post subject: you can fake it
PostPosted: Sun Sep 21, 2008 10:42 pm 
Offline

Joined: Tue Nov 18, 2003 8:41 pm
Posts: 250
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)


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sun Sep 21, 2008 11:53 pm 
Offline

Joined: Sat Jan 04, 2003 10:03 pm
Posts: 1706
The other method that I've used in the past is called "bias-128." What this means is that I map zero to $80, one to $81, and negative one to $7F. You'll sometimes see this in DACs, for example.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 19 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: