-
Notifications
You must be signed in to change notification settings - Fork 95
Description
Hi Ted,
Nice projects. I was using the MCL6809.ino and found a problem in the instructions opcode_0x1C () and opcode_0x1CA() for the respective instructions ANDCC immediate and ORCC immediate.
Replace UpdateFlags( AND_Common(REGISTER_CC,ea_data8) ); , with UpdateFlags(REGISTER_CC & ea_data8) ;
and replace UpdateFlags( OR_Common(REGISTER_CC,ea_data8) ); , with UpdateFlags(REGISTER_CC | ea_data8) ; to solve it.
The reason is that the AND_Common and OR_Common subroutines will change the NZV flags after the operation.
In some cases this may give the wrong result.
For instance V flag will be cleared, irrespective of the value of the operands.
If all the flags were all cleared before the ANDCC instruction, the zero flag will be set. That should not happen either.
Cheers.