6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Thu Nov 21, 2024 8:07 pm

All times are UTC




Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
PostPosted: Sat Feb 03, 2001 2:56 pm 
Hi,

Just need to find out very quickly how backward Branching is represented in the program.

Is it two's complement or Sign and magnitude?

Thanks

Konan


Report this post
Top
  
Reply with quote  
PostPosted: Sat Feb 03, 2001 10:35 pm 
Offline

Joined: Thu Oct 10, 2002 3:38 am
Posts: 6
Location: San Jose, CA
All signed arithmetic on the 6502, including
relative branch calculations, are Two's Complement.

I don't have an assembler handy to prove this, but

vaguely remember than an offset of 0 means the
instruction following the end of the branch statement,
because the PC has already incremented to point to the
next instruction before the offset is added if branch
is taken.... so something like:

HERE: BNE HERE
THERE:NOP

the offset for HERE would be -2 (FE), and BNE THERE
would be 0.

Hope this helps and isn't too wrong.

-- Ross

_________________
The economy isn't "Grapes of Wrath", but it is getting
to be "Raisins of Regret."

-- Ross


Report this post
Top
 Profile  
Reply with quote  
PostPosted: Sun Feb 04, 2001 6:12 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8543
Location: Southern California
> Hope this helps and isn't too wrong.

It's right. It would assemble D0 FE and D0 00.

_________________
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 24 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: