6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Wed May 08, 2024 7:54 am

All times are UTC




Post new topic Reply to topic  [ 32 posts ]  Go to page Previous  1, 2, 3
Author Message
PostPosted: Sun Mar 31, 2019 4:54 pm 
Offline
User avatar

Joined: Thu Mar 11, 2004 7:42 am
Posts: 362
The single step command has a bug (in the last version of C'mon that was released). There should be a CLD at STBR. If PREG bit 3 is set (i.e. the simulated instruction is executed with the D flag set) and the branch is taken, then the branch destination address is calculated using decimal arithmetic instead of binary arithmetic. Example:
Code:
300@F8,18,90,9,
30D@38,
313@D8,
300$$$$

The F8 (SED) puts us in decimal mode. 18 is CLC and 90 is BCC, so the branch is taken and the destination address is calculated using decimal arithmetic: $304+$09. (Note that this is a perfectly valid BCD addition.) So it incorrecly branches to $313 instead of $30D.

Incidentally, the "old monitor" ROM in the original Apple II has this very same bug in the S (Step) command. There should be a CLD inserted at BRANCH (at $FAFD).


Top
 Profile  
Reply with quote  
PostPosted: Sun Mar 31, 2019 4:56 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10800
Location: England
That's wonderful! A fix to a really old bug, and a warning about self-emulating on processors with modes.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 32 posts ]  Go to page Previous  1, 2, 3

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: