As per ztrumpet's question on IRC (since he doesn't want to create an account ):
It would be something like this:
Code:
To make the delays decrease faster, you would replace:
Code:
with
Code:
To make it twice as fast (and of course hl would have to start at a multiple of 2!) or ld de,-3 to make it three times as fast (and hl would have to start at a multiple of three), etc. Makes sense?
#cemetech on Efnet wrote:
[14:24:07] <ztrumpet> Oh, another thing
[14:24:28] <ztrumpet> How do I make it delay, but each time make the delay get shorter?
[14:25:14] <ztrumpet> Ex in basic: :50->B:Repeat 0:For(A,0,B):End:B-1->B:End
[14:24:28] <ztrumpet> How do I make it delay, but each time make the delay get shorter?
[14:25:14] <ztrumpet> Ex in basic: :50->B:Repeat 0:For(A,0,B):End:B-1->B:End
It would be something like this:
Code:
Delay:
ld hl,5000 ;maximum delay value
DelayOuterLoop:
push hl
pop bc ;this is like hl->bc
DelayInnerLoop:
dec bc
ld a,b
or c
jr nz,DelayInnerLoop
;---here is where you would do something---
;---the delay between the thing that happens here gets shorter---
dec hl
ld a,h
or l
jr nz,DelayOuterLoop
ret
To make the delays decrease faster, you would replace:
Code:
dec hl
ld a,h
or l
Code:
ld de,-2
add hl,de
ld a,h
or l