Re: A83: Direct Input/Delay


[Prev][Next][Index][Thread]

Re: A83: Direct Input/Delay






Jkhum98@aol.com wrote:
> 
> Ok, (to add on to my mail a little bit) I just decided to experiment with some
> delays, but it either froze my calc or is taking a helluva long time... :\
> Tell me how much this delay sucks, and give me a new one please, anyone...? Im
> not calling this in my Direct Input loop though. Its right after I switch the
> text video of that word (like i was talking about before), and then calling
> the Delay, and then jumping to my Direct Input loop. Whats the problem...?
>                                                                                                                                         --Jason K.
> Delay:
>         ld b, $FF
> DelayLoop:
>         push af
>         dec b         <------ HERE!
>         pop af
>         nop
>         djnz DelayLoop
>         ret


The problem is marked..   you start loading 255 in d (an odd number)  
and in every loop you dec b twice before you test if its zero! once with
the 'dec b' and one more time with the djnz.  the result is that b will
never reach 0. because after each loop b will be an odd number.. (an
even number subtracted from an an odd number will always result in an
odd number) and as we all know, 0 is even..

//Olle


References: