Keyboard input/Keypress check: Difference between revisions
Content added Content deleted
(JavaScript added) |
Puppydrum64 (talk | contribs) No edit summary |
||
Line 6: | Line 6: | ||
If no key has been pressed, the program should continue without waiting. |
If no key has been pressed, the program should continue without waiting. |
||
<br><br> |
<br><br> |
||
=={{header|6502 Assembly}}== |
|||
{{works with|https://skilldrick.github.io/easy6502/ Easy6502}} |
|||
Easy6502 uses zero page address FF as a memory-mapped port for keyboard input. The ASCII value of the last key you pressed is stored in this address, independent of the program's current execution state. |
|||
<lang 6502asm>define sysLastKey $ff |
|||
main: |
|||
jsr getKeyPress |
|||
jsr delay |
|||
jmp main |
|||
getKeyPress: |
|||
lda $ff |
|||
sta $00 |
|||
rts |
|||
delay: |
|||
nop |
|||
nop |
|||
dex |
|||
bne delay |
|||
rts</lang> |
|||
{{out}} |
|||
<pre> |
|||
Pressing various keys results in the following: |
|||
0000: 73 ;lower case "s" |
|||
0000: 31 ;"1" |
|||
0000: 20 ;spacebar |
|||
</pre> |
|||
=={{header|Ada}}== |
=={{header|Ada}}== |
||