I started this topic not because I have a question, but I have something cool to share. By default, in Axe, you can either use GetCSC to read your keys or read the input directly. However, this means that the key either responds once per press or responds as long as it is held down. What if you would like the key to instead respond every few frames, like a variable key repeat function? The solution is a key timer, which I will demonstrate below:
1. Set aside an area of free RAM, one byte per key you plan to read (the example uses 4 keys, one for each directional arrow):
0→L1
Fill(L1, 2
2. Create a subroutine that updates the key timers for each key:
{L1}+1*getKey(1)→{L1}
{L1+1}+1*getKey(2)→{L1+1}
{L1+2}+1*getKey(3)→{L1+2}
{L1+3}+1*getKey(4)→{L1+3}
Alternatively, instead of +1, you can add a variable that is updated by an interrupt.
3. After calling that subroutine, check for each key like so and preform the action:
If {L1}+1<127
...action...
End
...check the other keys...
4. After doing all you want to with the key, insert the following between your action and the End:
{L1}-[key delay in frames]→{L1}
The total effect of this code means that a key will register the instant it is pressed, and will then repeat in the delay you set.
This code is useful because not only does it let you control your key repeats, but it also condenses all your direct key reads to one place, allowing you to easily change the keys.