A83: Sv: delay routines...HELP!
[Prev][Next][Index][Thread]
A83: Sv: delay routines...HELP!
Hi there
OK... first a little list of commands you asked about:
Push bc ; Pushes register pair bc onto the stack for future use. (used if the following commands interfere with these)
Pop bc ; Retrieves what is next in the stack to register pair bc
Dec bc ; Decreases bc by 1
Inc bc ; increases bc by one
Here is a very simple delay rutine:
Push bc ; The b will be used so we have to save it
ld b, 255 ; load b with whatever between 1 and 255. The higher number the longer the delay
delayLoop:
djnz delayLoop ; decrease b. Jump if not zero
Pop bc ; all registers are back to the same as before delay
If you need a longer delay its almost as simple... just use two nested loops - remember to push/pop bc. Another way is doing it manually. Let me know if you need more and I'll write a longer letter offline..
***
Thomas Turn Jensen
Icq uin => 8128636
IRC, Undernet => Mukke
***
If your computer gives you trouble
Call for Mukke on the double
***
-----Oprindelig meddelelse-----
Fra: Dan G. <idsoccer@lesbois.com>
Til: ASM 83 Mailing list <assembly-83@lists.ticalc.org>
Dato: 2. oktober 1998 19:33
Emne: A83: delay routines...HELP!
>
>I have been trying for a few weeks to get a good delay rountine to slow
>down my program in places. I studied the code of many games that use
>delays, and I can't figure out what the commands do. If I implement other
>peoples delay code, my calc crashes.I haven't seen them in any tutorials or
>at the TI site. Many of the routines are similar from different programs.
>Here's the code from frogger...
>
>DelayChk:
> push af <<<<what does push do?
> push bc
> ld a,(level) <<<<I understand the speed settings
> cp 1
> jp z,d2500
> cp 2
> jp z,d2000
> cp 3
> jp z,d1500
> cp 4
> jp z,d1000
> jp nz,500
>d2500:
> ld bc,$2500 <<<<what does the $(number) mean?
> jp delayLoop
>
>d2000:
> ld bc,$2000
> jp delayLoop
>
>d1500:
> ld bc,$1500
> jp delayLoop
>
>d1000:
> ld bc,$1000
> jp delayLoop
>
>d500:
> ld bc,$500
> jp delayLoop
>
>delayLoop:
> DEC BC <<<What is DEC
> LD A, B
> OR C <<what is OR C
> JR NZ, delayLoop
> POP BC <<<what is POP
> POP AF
> ret
>
>
>