6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Tue Oct 01, 2024 9:42 am

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Thu Aug 19, 2010 8:33 pm 
Offline

Joined: Wed Jun 24, 2009 12:25 am
Posts: 29
...that's what i'm wondering now while looking at the ROR behavior.

e.g.: ROR Accumulator:
Code:
byte src; // just an unsigned 8-bit number

src = (ACC >> 1); // store the rotation temporary
if(C_FLAG) src |= 0x80; // if C was set, then set the #7 bit of the rotation's result
C_FLAG = ACC & 0x1;
Z_FLAG = !(src);
N_FLAG = !!(src & 0x80);


but it's only that? or i'm missing the...:
Code:
ACC = src;

...final line?

in that case, flags are setted/reseted relying on the accumulator's (or whatever the source is) final value? or is it correct to change the flags BEFORE the original data gets overwriten?

_________________
sorry about my english, i'm from Argentina :S

http://felliniycia.comule.com/


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat Aug 21, 2010 6:04 pm 
Offline
User avatar

Joined: Thu Mar 11, 2004 7:42 am
Posts: 362
Yes, you need the ACC=src line. With that line, it looks correct. The N and Z flags are always based on the final value (for any instruction that affects them), not the original value. For other addressing modes, you would read and write to the appropriate memory location rather than the accumulator, of course.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat Aug 21, 2010 9:31 pm 
Offline

Joined: Wed Jun 24, 2009 12:25 am
Posts: 29
...so it means that the instruction DO overwrite the original data, even in all the others addressing modes.

thanks a lot mate! :wink:

_________________
sorry about my english, i'm from Argentina :S

http://felliniycia.comule.com/


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

All times are UTC


Who is online

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