Re: A86: Timer Routine
[Prev][Next][Index][Thread]
Re: A86: Timer Routine
What I'd like to do is to make another counter in the mainloop. That way it
wont slow down the game. Look below:
Start:
xor a ;Same as ld a,0 but one byte shorter(updates the ld
(Delay),a ;flags)
.
.
MainLoop:
.
.
ld a,(Delay)
inc a
cp 200 ;Experiment which number gives the desired delay
call z,DoTimer
ld (Delay),a
.
.
>DoTimer:
xor a
ld (Delay),a
> ld a,(timercount)
> dec a
> cp 0
> jp z,DT1
> ld (timercount),a
> ret
>DT1:
> ld a,(timer)
> dec a
> cp 0
> jp z,DTENDG
> ld (timer),a
> ret
>DTENDG:
> ld a,5
> ld (quitflag),a
> ret
>From: "Akshay Dhalwala" <akdjr@SoftHome.net>
>hi,
>i have another question. I am trying to make a timer routine for my game.
>here is the routine the i made:
Look above
>it works fine, but it is too fast. in the beginning of my program, i load
>timercount with 200. basically, it will decrease timercount and if it is
>0, then it will decrease timer. but it is too fast. as you can see, i
>tried to make it last for a second with the djnz and halt combination, but
>then my game is too slow. can anyone help?
>
>akshay
>http://akdjr.freeservers.com
______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com