futz
Active Member
No. Not quite. When d1 reaches zero and d2 gets decremented, the code goes back and decrements d1 again. An unsigned byte can't be negative, so when you decrement that byte with a value of zero it becomes $ff (255). So after the first time d1 is $ff every time through. It's not getting reloaded with $4e, you see?AHH! So you mean that d1 decrements like this:
77, zero? No. $+2, goto Delay_0 again. 76.. zero? No.. etc.. Zero? Yes. Skip $+2 decrement 196 decimal to 195 decimal, goto Delay_0, starts decrementing again the 78 decimal.. and so on until the 196 reach 0. When he reach 0 he goto nop (spending more cycles) and then goes back to the main routine. That's it? BTW, it's necessary to add the goto $+1 and nop?
Also, every time decfsz hits zero, it becomes a two-cycle instruction for the branch. Also, goto is a two cycle instruction, so count in all those extra cycles.
Last edited: