| Author |
Message |
BASIC_bro Newbie
 Joined: 11/05/2026 Location: United StatesPosts: 4 |
| Posted: 03:47am 11 May 2026 |
Copy link to clipboard |
 Print this post |
|
Hello, attempting to write something in MMBasic on a PicoCalc, "inkey" looked like the way to go.
After seeing it missed some keys, more searching returned "keydown", but that always returns 0. "Option explicit" suggests it doesn't exist in this version of MMBasic, and is being interpreted as a variable: " Error : KEYDOWN is not declared"
mm.ver returns 6.0002
Oddly, inkey returns a code for the arrow keys and for delete, but not backspace. Per the manual, that looks to be expected. https://geoffg.net/Downloads/picomite/PicoMite_User_Manual.pdf
Is keydown's absence a bug, a case of "we're not done porting" or a feature deliberately left out of the PicoCalc version of MMBasic?
If keydown will not be added, is there/will there be a way to read backspace through inkey or another language feature?
Thanks! |
| |
ville56 Guru
 Joined: 08/06/2022 Location: AustriaPosts: 508 |
| Posted: 04:33am 11 May 2026 |
Copy link to clipboard |
 Print this post |
|
from the manual:
KEYDOWN(n) Return the decimal ASCII value of the keyboard key that is currently held down or zero if no key is down. This function applies to USB keyboards and PS2 keyboards (in MMBasic 6.02.01 or later).
You have version 6.00.02 ... 73 de OE1HGA, Gerald |
| |
Frank N. Furter Guru
 Joined: 28/05/2012 Location: GermanyPosts: 1100 |
| Posted: 06:37am 11 May 2026 |
Copy link to clipboard |
 Print this post |
|
...and you don't have a USB or PS/2 keyboard! This keyboard works via I2C...
Frank Edited 2026-05-11 16:38 by Frank N. Furter |
| |
BASIC_bro Newbie
 Joined: 11/05/2026 Location: United StatesPosts: 4 |
| Posted: 11:05pm 11 May 2026 |
Copy link to clipboard |
 Print this post |
|
Thanks to both of you for your responses.
My confusion probably came from having opened several copies of the manual.
In one (the appropriate one), keydown isn't even mentioned.
I don't remember reading about USB/PS2, which means I probably had https://fruitoftheshed.com/wiki/lib/exe/fetch.php?media=mmbasic_hardware:mmb4w_user_manual_v0.97.pdf open. Had I scrolled up on that copy, I'd have seen "MMBasic for Windows". (I might have, and seeing version 5, may have assumed all MMBasic 6s would have it.)
https://mmbasic.com/Download/MMBasic%20Language%20Manual.pdf has keydown in version 4.5, but does mention a PS2 keyboard.
As for what I was writing, it's working fine, using the delete key for backspace as a stopgap.
Will look into a few of the other languages available for the PicoCalc to see which allow capturing all keys, and paying attention to the versions this time! |
| |
BASIC_bro Newbie
 Joined: 11/05/2026 Location: United StatesPosts: 4 |
| Posted: 03:40am 12 May 2026 |
Copy link to clipboard |
 Print this post |
|
A little more digging, and MMBasic will do what I was hoping.
ON KEY 8, HandleBackspace ... SUB HandleBackspace() PRINT "B" END SUB
Though if you break execution, backspace won't work (del will) until the interrupt is cleared. ON KEY 8, 0
(Though the interrupt blocks the normal operation of backspace, it does not print B anymore once the program is halted.) |
| |
Frank N. Furter Guru
 Joined: 28/05/2012 Location: GermanyPosts: 1100 |
| Posted: 04:48pm 12 May 2026 |
Copy link to clipboard |
 Print this post |
|
Have you heard of this program? Maybe it'll be helpful...
https://forum.clockworkpi.com/t/picocalc-keyboard-testing-in-mmbasic/19794
Frank |
| |
BASIC_bro Newbie
 Joined: 11/05/2026 Location: United StatesPosts: 4 |
| Posted: 06:47pm 15 May 2026 |
Copy link to clipboard |
 Print this post |
|
I have not.
Did run across another interesting issue.
Copying a database onto the device to carry wherever I go (previously kept in a web page on a phone), to make things simpler for version 1, the record format looked like: chr(1)LF Samurai CatLF chr(2)LF ComicsLF chr(2)LF ComicLF chr(2)LF By:LF Mark E. RogersLF Epic comicsLF chr(2)LF 1-2LF chr(2)LF 3LF chr(2)LF 0LF
All lines terminated by 1 line feed, record delimiter is 0x01 followed by a newline, field delimiter is 0x02 followed by a newline, lines > 50 characters are broken into 50 characters to fit the font-size used without requiring the PicoCalc to reformat.
After a while, this became
chr(1)LF Title Samurai CatLF TypeLF ComicsLF SubtypeLF ComicLF NotesLF By:LF Mark E. RogersLF Epic comicsLF HaveLF 1-2LF NeedLF 3LF DoneLF 0LF
Then, rather than repeat fieldnames:
chr(1)LF chr(2)LF Samurai CatLF chr(3)LF ComicsLF chr(4)LF ComicLF chr(5)LF By:LF Mark E. RogersLF Epic comicsLF chr(6)LF 1-2LF chr(7)LF 3LF chr(8)LF 0LF
with the client program turning chr(2) to "=====TITLE=====", chr(3) to "=====TYPE=====" etc.
Until chr(8), which LINE INPUT hiccuped on.
8 and 9 don't work, 10 is in use, 11 works. |
| |