[A83] Loop + Getkey


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

[A83] Loop + Getkey




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: