Page 3 of 3

Re: ANNOUNCE: C'mon, the Compact MONitor

Posted: Sun Mar 31, 2019 4:54 pm
by dclxvi
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: Select all

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).

Re: ANNOUNCE: C'mon, the Compact MONitor

Posted: Sun Mar 31, 2019 4:56 pm
by BigEd
That's wonderful! A fix to a really old bug, and a warning about self-emulating on processors with modes.