Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!wuarchive!emory!gatech!mcnc!uvaarpa!haven!decuac!shlump.nac.dec.com!sousa.enet.dec.com!pinbot.enet.dec.com!ervin From: ervin@pinbot.enet.dec.com (Joseph James Ervin) Newsgroups: comp.sys.handhelds Subject: (HP48SX) Strange behavior...bug? Message-ID: <990@sousa.enet.dec.com> Date: 22 Mar 91 13:48:53 GMT Sender: newsa@sousa.enet.dec.com Reply-To: ervin@pinbot.enet.dec.com (Joseph James Ervin) Organization: Digital Equipment Corporation Lines: 46 I have recently been experimenting with the KEY function on my HP48SX in preparation for some games programming, and I have seen some strange behavior that points to a possible bug. I wanted to post my observations here so that other people could try to reproduce the behavior. What I'm seeing is an inconsistency when using the KEY function. The KEY function returns a 0 to level 1 if no key is pressed, and if a key is pressed returns a 1 in level 1 and the keycode in level 2. Following the style of the example use in the programmers reference manual, I wrote the following program. \<< DO UNTIL KEY END \>> This simple program stays in the indefinite loop until a key is pressed, and leaves the keycode on the stack when it leaves the loop. This seems to work fine, which is to be expected since this is taken directly from the reference manual. Next, I tried this simple variation; I wanted to wait for 10 key presses and then exit. \<< 1 10 FOR I DO UNTIL KEY END NEXT \>> This program should wait for 10 key presses, and leave the 10 keycodes on the stack. Unfortunately, the actual number of key presses I must make tends to vary from 10 to as high as 14. I realize that the KEY function does not wait for a key press, but I see the same behavior even when I press the keys very slowly (once a second) an very deliberately (firmly holding the key down each time I press one). I am very surprised that this simple program would behave so unpredictably. The other annoying thing about this program is that sometimes it works fine, being able to "see" all 10 of my key presses even if I do them rather fast. At other times the program seems to miss many of them, requiring me to press 13 or 14 keys to get the program to exit. I almost wonder if it might be temperature dependent. Could people out there please try the above program and post a response to this message indicating the success or failure of the program? Thanks, >>>Joe Ervin