86 ASM: ret program glitch
[Prev][Next][Index][Thread]
86 ASM: ret program glitch
I am having a problem with exiting a program. I'm using a GET_KEY
procedure (displayed at the end), which is most of the program. The ret
goes back to absolutely nothing, but the final ret. The call right
before this procedure is the last command in the main procedure. For
some reason, it doesn't exit until the second time I press EXIT. It
doesn't matter when I press exit the first or second times, the second
time I press exit, it quits, and not before. I could push exit, push
every other button, and then push exit again, and it would close. It
seems to still follow the GET_KEY proc after the first exit, which
shouldn't happen. It's returned out of it, right? What is going on??
MainLoop:
call CheckForKey
ret
CheckForKey:
halt
call GET_KEY
cp K_1
jp z,Ch1
cp K_2
jp z,Ch2
cp K_3
jp z,Ch3
cp K_4
jp z,Ch4
cp K_5
jp z,Ch5
cp K_6
jp z,Ch6
cp K_7
jp z,Ch7
cp K_8
jp z,Ch8
cp K_9
jp z,Ch9
cp K_EXIT
ret z
cp 0
jp z,CheckForKey