Author Topic: Doh, assembly is not like a bicycle  (Read 493 times)

0 Members and 1 Guest are viewing this topic.

Offline opqa

  • CPC664
  • ***
  • Posts: 73
  • Country: es
  • Liked: 82
Re: Doh, assembly is not like a bicycle
« Reply #10 on: 22:57, 20 March 17 »
This is so typical... There is nothing wrong with your original code, it runs well, "too" well in fact.

The problem is not related with key queuing, the firmware indeed maintains a keypress queue, but &bb1e doesn't care about it, it just informs you whether the indicated key is pressed or not. The only "problem" is just that your code is "too" fast. When you hit enter after having written "call &4000" the code starts executing immediately, it doesn't wait for you to release the Enter key. When the loop arrives at the point of checking this key, few milliseconds later, your finger is still there, you just haven't got enough time to lift it.

You can solve this "problem" in many ways, you can just add a long delay at the beginning of execution to give you time to release the key, you can try to detect a "not pressed -> pressed " transition as in Alexay variant instead of just a key pressed condition as in yours, you can test the routine from WinAPE by running it from the Assembler menu instead of calling it from BASIC...

Or you can do nothing, because depending on when and how you call this routine from your program this problem may or may not arise, it's your choice.
« Last Edit: 08:22, 21 March 17 by opqa »