I am currently maintaining and documenting some older code made with Keil version 9.53.
I don't have access to that version, so I compiled the code with Keil version 9.60, and to my surprise, the binary was 8 bytes bigger.
I kind of expected the new binary would be an exact copy of the old binary.
I needed to understand why there was this discrepancy, so I looked into the code by hand dis-assembling where I could see the differences. (It is a small program!)
Here is what I found:
I am using a simple while loop in two places:
while (3 > TimerCnt2);
TimerCnt2 is an unsigned char and incremented in a Timer 2 ISR.
In Keil version 9.53, this loop is translated into:
loop1:
oop1:
mov a, TimerCnt2
clr c
subb a, #3
jc loop1
In Keil version 9.60, the same loop is translated into:
mov a, #80h
subb a, #80h
Two instructions more here than with version 9.53, and 4 bytes more per loop!
Both versions of course works as intended, and now comes my question:
Why the two extra instructions? It doesn't make the code run faster or reduce the space.
Anybody?
Thanks,
Claus