LZ: RE: Stupid Newbie Question: Why doesn't this work?


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

LZ: RE: Stupid Newbie Question: Why doesn't this work?



On Thursday, July 17, 1997 3:04 AM, Nick Zitzmann[SMTP:nickzman@eskimo.com] wrote:
> Loop:
>   call GET_KEY
>   cp K_EXIT
>   jr z,Loop
>   ret
> 
> .end
> 
> For some reason, this program won't run, and I (being new to assembly
> programming in general) don't see what's wrong with it. Does anyone?

I think it actually does run, it just does it so quickly that you don't see it! The reason for this is when you're waiting for a key, you should use 'JR NZ,Loop' instead of 'JR Z,Loop', because the Zero flag is set if two things are equal... so in your code, it will wait *only* if you're holding down EXIT! (and you won't have enough time to switch from ENTER (to run the program), to EXIT, so don't even try :)
	Sam

-- 
Sam Davies <sdavies@mail.trilogy.net>