
www.Usenet.com
| <-- __Chronological__ --> | <-- __Thread__ --> |
Aaaah, now I got it! The problem was that I read somewhere that a SUB instruction generates a carry flag when subtracting a negative number and the result becomes too big. So I automatically assumed somehow that an ADD instruction also generates a carry flag when adding a negative number (which is wrong). I also forgot that when I have a negative number, also the high halfword will be FFFF. I thought it would be zero because the abs(i) is small enough to fit into the low halfword, but due to the sign it is NOT zero. Peter: I am not using the counter macro because this operation is one of many operations in an algorithm and the value needs to be in the RAM which is only connected to the processor. Thanks to everybody who helped me out with this.
| <-- __Chronological__ --> | <-- __Thread__ --> |