![]() |
Forum Index : Microcontroller and PC projects : Alternatives for KEYDOWN in MMBasic 5
Author | Message | ||||
karjo238 Regular Member ![]() Joined: 12/10/2018 Location: New ZealandPosts: 60 |
Sigh..... *Hopefully* this will be the last question I need to ask here, because everything else I'm doing has been sorted, so here we go.... ![]() I note that KEYDOWN has been removed from MMBasic for the Micromites because it was never meant as a games playing platform, and yet here I am stubbornly trying to do what shouldn't be done. I know that INKEY$ is available, but that won't help me capture arrow button presses or multiple keypresses at once (I could be wrong tho...) The alternative I can see is ON KEY target, which when I set up a short test program detects all the keys I need. The one problem I have is being able to read the value of the keypress that triggers this. Can somebody enlighten me as to whether this value can be obtained, if at all? If this is a dead end, I can always go to INKEY$, but in an ideal world, I would really like to use the arrow keys. Again and as always, many thanks. This forum really has been such a godsend for my stubbornness. Joseph ![]() |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6283 |
What device are you using? KEYDOWN was removed from MMBasic for the Micromites because the only chance you have of detecting multiple key presses is with a directly connected keyboard. Anything else depends on the terminal program being used. The arrow keys should be detected OK: up arrow chr$(128) down arrow chr$(129) left arrow chr$(130) right arrow chr$(131) Jim VK7JH MMedit |
||||
SimpleSafeName![]() Guru ![]() Joined: 28/07/2019 Location: United StatesPosts: 351 |
If you knew the address of where the keys came in to the firmware, you could use PEEK. Ah, like this: do print @(100,1) for i = 0 to 255 x=PEEK(KBUF,i) if x<10 then a$=" 00"+str$(x) elseif x<100 THEN a$ = " 0"+str$(x) else a$ =" "+str$(x) endif print a$; next Loop Edited 2019-08-25 16:20 by SimpleSafeName |
||||
karjo238 Regular Member ![]() Joined: 12/10/2018 Location: New ZealandPosts: 60 |
Hey Jim! Apologies, I should have mentioned I'm using a Micromite Extreme 144. I'm using a PS/2 keyboard and a VGA monitor, so it's standalone, which is one of the main reasons I like these systems. I have got INKEY$ to work, but given that I'm writing a game, it's not the greatest solution, so if there is a better one, I would be most gratified to hear about it. Manny thanks as always, Joseph. |
||||
karjo238 Regular Member ![]() Joined: 12/10/2018 Location: New ZealandPosts: 60 |
Can anyone help here, or is there no alternative to inkey$? Apologies if bumping a thread is bad form on this forum, but I'd just like to get a definitive answer to this. Many thanks, Joseph. |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10310 |
Give me a day or two and I'll include it in the MMX firmware |
||||
karjo238 Regular Member ![]() Joined: 12/10/2018 Location: New ZealandPosts: 60 |
Sorry for the late reply, but thank you so much! It will make what I'm trying to do that much easier (and better, for that matter!) It's gratifying to be able to reach out and get help like this when you need it. Yay for the Internet! :D Joseph. |
||||
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |