??? 07/29/05 20:55 Read: times Msg Score: 0 +1 Good Question -1 Message Not Useful |
#98453 - This weeks puzzle |
This weeks puzzle
Little Joe who loves C reads in many posts that a delay routine should be made in assembler and decides to make one. He has a C function definition: void Delay (unsigned short count); He finds out correctly that "count" will be in R6 (MSB) and R7 (LSB) when "Delay" is called so little Joe writes the following routine Delay: ;; here loop: djnz r7,loop djnz r6,loop retLittle Joe finds out that this works correctly in most cases, but fails for some values of "count". He then adds some code where ";;here" is and the code works in all cases What code did little Joe add? Erik PS: the same measures should be taken every time there is a multibyte loop in asm. |