Re: A82: My first question of many to come
[Prev][Next][Index][Thread]
Re: A82: My first question of many to come
At 12:00 1998-02-03 -0800, you wrote:
>
>David Eriksson/2GooD Productions wrote:
>
>> Why not make a loop (maybe reading the key directly from the i/o port) > which updates the animation, say, every 100 times? Replace 100 with > whatever makes good animation speed.
>>
>
> How exactly would I go about doing this? In other words, how do I check
>hl for every 100th count? Or Nth count, whatever.
I'd probably make a separate count or an inner loop, but you could also do like this:
; HL is counter
LD A, L
AND 15
JP Z, Event
; Repeat loop
This code would make a jump to 'event' every 16 loops. As you probably know the bitwise AND operation extract certain bits. So you trigger an event when certain low bits are zero.
Note: this only works with powers of two. AND with 3 to do it every four loops, with 7 to do it every 8 loops, etc.
(Somehow powers of two always appears in assembly... :-)
Regards,
-/- David Eriksson -/-
2 G o o D P r o d u c t i o n s -> http://www.2goodsoft.com/
References: