Your number is printed many times because it is using a semicolon after a PRINT that is not LOCATEd. What key is code 2 or 3 anyhow? You would need 128 cases for just keypresses alone!
The idea to learn INP(&H60) is to find out what keypress creates what code.
You can find many of the keys with 2 byte ASCII codes like CHR$(0) + CHR(asciicode) using INKEY instead. Try the arrow keys.
Ted
Fastest way to get Keyboard presses
- burger2227
- Veteran
- Posts: 2466
- Joined: Mon Aug 21, 2006 12:40 am
- Location: Pittsburgh, PA
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0