IN command and keyboard scanning - Is this a bug in BASin?
Hi Folks,
Still reading Dilwyn Jones book on the Spectrum and I have got to the section on IN and keyboard scanning. I wrote the following wee program to test this out:
The book states that the IN commands should display 255 unless I press one of the keys on the row they are mapped to. When I run the above in BASin I get 191 displayed.
Is this a problem with BASin or is the book wrong?
Many thanks
Paddy
Still reading Dilwyn Jones book on the Spectrum and I have got to the section on IN and keyboard scanning. I wrote the following wee program to test this out:
100 CLS 110 PRINT AT 0,0;"IN 63486 (1-5) =";IN 63486;" " 120 PRINT AT 1,0;"IN 64510 (Q-T) =";IN 64510;" " 130 PRINT AT 2,0;"IN 65022 (A-G) =";IN 65022;" " 140 PRINT AT 3,0;"IN 65278 (CAPS-V) =";IN 65278;" " 150 PRINT AT 4,0;"IN 61438 (6-0) =";IN 61438;" " 160 PRINT AT 5,0;"IN 57342 (Y-P) =";IN 57342;" " 170 PRINT AT 6,0;"IN 49150 (H-ENTER)=";IN 49150;" " 180 PRINT AT 7,0;"IN 32766 (B-SPACE)=";IN 32766;" " 200 GO TO 110
The book states that the IN commands should display 255 unless I press one of the keys on the row they are mapped to. When I run the above in BASin I get 191 displayed.
Is this a problem with BASin or is the book wrong?
Many thanks
Paddy
Post edited by Paddy Coleman on
Comments
Bytes:Chuntey - Spectrum tech blog.
Paddy
This little program I threw together shows the affect of multiple key presses. Spectrum emulators show different behaviour compared to a real spectrum when certain keys combination of three or more are pressed simultaneously.
Keyboard Scanner (tzx)
Keyboard Scanner (z80)
As for the other matter, PC keyboards were initially designed to type, not to play games. How many and which keys can be pressed together varies from keyboard to keyboard and from keyboard handler to keyboard handler. There's really nothing an emulator coder can do about it.
There's a cheat in Phantomas 2 which takes you to the last stage if you press the whole two first rows of keys (1-0 and Q-P) which can't be achieved on a PC emulator due to keyboard restrictions.
and due to the ZX Spectrum keyboard bug this can be reached by pressing just 12 keys. An example:
press 1-5 and Q and 6-0 and P or any key on the second row per port will do.