[A83] Re: Loop + Getkey
[Prev][Next][Index][Thread]
[A83] Re: Loop + Getkey
Duhh, instead of increasing b,
it pops the return address from the stack, and inreases it by one, and
puts it back.... now if you do that, a lot of strange things happen..
assuming you put bc in the stack, and called the routine,
the routine should do:
pop hl
pop bc
inc b
push bc
push hl
instead of just
pop bc
inc b
push bc
get it....?
On Sat, 27 Apr 2002 VertGuy@aol.com wrote:
>
> Hi guys,
> I have a repeating loop using 'djnz', and I want to put a getkey
> command in there so as the loop is repeating, a certain keypress will
> increase b, thereby causing the loop to continue longer. I also have a user
> defined variable that I want to change with the same keypress.
> I tried making a routine that uses direct input and if no key press or
> not 2nd key, it returns... this part of it worked fine... Now to what
> didn't work... When you hit the 2nd key, it either stops the loop where its
> at or crashes. Here's the getkey part...
>
> getkey:
> ld a,kReset
> out (1),A
> ld a,Group7
> out (1),A
> in a,(1)
> cp k2nd
> ret nz
> pop bc
> inc b
> push bc
> ret
>
> Thanks for any suggestions
>
Follow-Ups:
References: