Created
April 11, 2020 13:22
-
-
Save remy/0a20055ba5eea4d9847635af032cc923 to your computer and use it in GitHub Desktop.
keyboard press testing for NextBASIC
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 ; | |
11 ; Keypress combination example | |
12 ; Note that I am using the bit shift to allow | |
13 ; the INVERSE command to work. | |
14 ; If you're testing for a single keypress, then use: | |
15 ; IF %(IN $FBFE & 0b0010)=0 THEN ... | |
16 ; See page 272 of NextBASIC manual for ports | |
17 ; | |
100 PRINT AT 0,0; INVERSE %( IN $fbfe >> 0 & 1 ^ 1);"q" | |
101 PRINT AT 0,1; INVERSE %( IN $fbfe >> 1 & 1 ^ 1);"w" | |
102 PRINT AT 0,2; INVERSE %( IN $fbfe >> 2 & 1 ^ 1);"e" | |
103 PRINT AT 0,3; INVERSE %( IN $fbfe >> 3 & 1 ^ 1);"r" | |
104 PRINT AT 0,4; INVERSE %( IN $fbfe >> 4 & 1 ^ 1);"t" | |
105 ; | |
106 ; Now for the rest of the keys in this row we have | |
107 ; to go backwards (Y is bit 4). I've also used decimal | |
108 ; port number, just to show a mix of hex and dec. | |
109 ; | |
110 PRINT AT 0,6; INVERSE %( IN 57342 >> 4 & 1 ^ 1);"y" | |
111 PRINT AT 0,7; INVERSE %( IN 57342 >> 3 & 1 ^ 1);"u" | |
112 PRINT AT 0,8; INVERSE %( IN 57342 >> 2 & 1 ^ 1);"i" | |
113 PRINT AT 0,9; INVERSE %( IN 57342 >> 1 & 1 ^ 1);"o" | |
114 PRINT AT 0,10; INVERSE %( IN 57342 >> 0 & 1 ^ 1);"p" | |
1000 GO TO 10 | |
9999 CLEAR : SAVE "keys.bas" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment