Re: A86: Re:


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

Re: A86: Re:




In a message dated 11/4/98 10:41:59 PM Eastern Standard Time,
Assembly86@aol.com writes:

> It looks good except you just have a key loop! You need to store the number 
> of
>  times that the key is pressed.
>  
>  ( Try This )
>  
>  Start:
>  	xor a
>  
>  KeyLoop:
>  Whatever.......
>  ......
>  ......
>   cp	k_F1		;Compare to F1
>   jp	z,keypress		;If pressed jump to label
>  ........
>  .......
>  Keypress:
>  	add a,1			;A+1->A
>  	cp 2			;Two times
>  	jr	z,exit
>  	jp	nz,keyloop
>  

how about this instead (shorter, does same thing)

Start:
	ld a,2				;two keypresses to read

Keyloop:
	....
	cp K_F1
	jr z,keypress
	...

keypress:
	dec a				;a-1->a
	jr z,exit				;when a=0, exit
	jr keyloop			;get another key


Follow-Ups: