A86: Timer Routine


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

A86: Timer Routine



hi,
i have another question.  I am trying to make a timer routine for my game.  here is the routine the i made:
DoTimer:
 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
; ld b,200
;DTST:
; halt
; djnz DTST
 ret
DTENDG:
 ld a,5
 ld (quitflag),a
 ret
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