Three questions about keyboard-input in MSX-BASIC

Страница 1/2
| 2

By JohnHassink

Ambassador (5655)

Аватар пользователя JohnHassink

25-07-2007, 01:51

* Is there ANY way of reading [GRAPH] and/or [CTRL] input, using some corresponding ASCII-code? As in: "A"=CHR$(65), [RETURN]=CHR$(13) etc?

* If not, is there an alternative way?

* Who can tell me which DEFUSR-adress is preserved for cleaning the keyboard buffer? I forgot...

Для того, чтобы оставить комментарий, необходимо регистрация или !login

By NYYRIKKI

Enlighted (6016)

Аватар пользователя NYYRIKKI

25-07-2007, 08:18

* No, there is no ASCII code for CTRL or GRAPH. If they are used in combination with other letters they will have effect to ASCII code anyway.

* First question makes me think you are talking about BASIC. So maybe this helps:

if peek(&HFBEB)and2 then else ?"CTRL pressed"
if peek(&HFBEB)and4 then else ?"GRAPH pressed"

* DEFUSR=&H156

By JohnHassink

Ambassador (5655)

Аватар пользователя JohnHassink

25-07-2007, 19:13

Great, thanks a lot!

By CrazyBoss

Master (210)

Аватар пользователя CrazyBoss

25-07-2007, 21:32

hi i didn know there is a defusr=&H156 Smile

as a basic programmer i always used

10 if inkeys$>"" then 10

-Claus

By MäSäXi

Paragon (1884)

Аватар пользователя MäSäXi

13-07-2011, 14:06

I will continue BASIC programming questions about this.

Ok, DEFUSR=&H156 is fine I guess when you press letters or numbers, but what then if you use A$=INKEY$ to detect keyboard and someone presses function key?

Result: DEFUSR=&H156 will not help, as each function key acts like multiple "keys" pressed at the same time, like if you press F1, you get letters c, o, l, o and r, that is five key presses indeed. That means, if you have several text pages (like story of a game or game instructions) and each text screen ends with "Press any key" and you use A$=INKEY$ and user presses function key, user will see several text screens quickly disappearing as soon as they get drawn. Imagine someone presses F1 just twice, you can count how many screens are drawn and disappeared before user´s eyes.

How can you disable function keys?

And how you can get them alive again?

By JohnHassink

Ambassador (5655)

Аватар пользователя JohnHassink

13-07-2011, 14:43

I guess you already tried KEYOFF? Or is it still detected when you push it then?

By Warchild

Paragon (1298)

Аватар пользователя Warchild

13-07-2011, 16:33

I think KEYOFF just disables the display of the content at the bottom line, maybe you have to redefine function keys with empty strings. I don't rememeber the command exactly... maybe something like KEY 1,""

(Edit: Yes, it's KEY n,"string". Tried it on BlueMSX and worked, if redefined with empty strings have no effect when pressed)

By JohnHassink

Ambassador (5655)

Аватар пользователя JohnHassink

13-07-2011, 16:36

Oh yes, you're right, it just disables the display.. Eek! It has been too long for me. Smile

How was it again? KEY(1)OFF etc. or something like that.

Redefining it to empty strings seems indeed as a good idea!

By Warchild

Paragon (1298)

Аватар пользователя Warchild

13-07-2011, 16:43

I think you were thinking about ON KEY... GOSUB, so you can activate with key(n)on/off the function keys you want to be available or so... my skills are so low... it's not usual I can help in this topics Smile

If there's any question about CLS, maybe I will be able to help again XD

By JohnHassink

Ambassador (5655)

Аватар пользователя JohnHassink

13-07-2011, 16:47

I think you were thinking about ON KEY... GOSUB, so you can activate with key(n)on/off the function keys you want to be available or so...
Yes, that was exactly what I meant, but couldn't remember properly. So regardless of your skills, you helped out! Wink

By MäSäXi

Paragon (1884)

Аватар пользователя MäSäXi

13-07-2011, 19:21

Thank you John, but KEY OFF just really makes function key list disappear from the bottom of the screen and gives you one more line to write. Smile

And thank you warchild, the answer was too near so I couldn´t see it!!!! Tongue So simple solution indeed!!

I tried it and it worked well, and ON KEY GOSUB still works after that. Smile

Though, by doing so, there is one bad thing, you will delete all those handy quick key words, like LIST and RUN+CHR$(13). Was there some POKE which reseted function keys back to normal? I think I have seen such thing mentioned here ages ago. Not 100% sure though.

Страница 1/2
| 2