![]() |
Forum Index : Microcontroller and PC projects : MMBasic for Windows - pre-alphas
![]() ![]() ![]() ![]() |
|||||
Author | Message | ||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10068 |
Jim: The dos window from which you run MMbasic must remain open. If you try from a normal DOS box it works fine. Not sure how this would integrate with MMEdit All colours are now ARGB8888. If you use the direct hex code then you must set the A. The RGB function can take 1, 3, or 4 parameters. In the case of 3 parameters it assumes A=255 and of course defined colours like "RED" have A set to 255 |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6220 |
I was trying from a command prompt (as well as MMEdit) I will do some more playing. If I can start from abatch file, I can work something out. Jim VK7JH MMedit |
||||
JohnS Guru ![]() Joined: 18/11/2011 Location: United KingdomPosts: 3998 |
I hope this isn't a silly question: Why does MMBasic for Windows need to do any keyboard mapping at all? I thought Windows already did it... John |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10068 |
It does some of it e.g. the alpha characters but I'm operating at a low level of key down/key up to allow some of the facilities MMbasic is used to and at that level the OEM keys aren't mapped and shift/ctrl/alt have to be implemented in my code Just tested again. Opened a DOS box. CD to the MMBasic directory. Type "MMBasic" The Window then opens and stays open until closed either by exiting the application or closing the dos box |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10068 |
pa11 MMBasic.zip Most file handling commands and function are now there and work based on very cursory testing. Use LIST COMMANDS and LIST FUNCTIONS to see which The big thing missing is the DIR$ function and sorting out the FILES command. Unfortunately, windows doesn't support the "dirent.h" header I used in the Raspberry Pi so they will need coding from scratch using windows calls. Jim: do you have any serial port code that I might find useful when I start on that (getting list of available ports etc.) |
||||
toml_12953 Guru ![]() Joined: 13/02/2015 Location: United StatesPosts: 390 |
OK, on my system autosave by itself works but autosave "myprog" gives a syntax error. |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10068 |
gives a syntax error. That's because it is a syntax error. Assume PicoMite functionality unless I state otherwise |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10068 |
pa12 Last update for a few days MMBasic.zip lots of good file stuff FILES command and DIR$ as per the PicoMite manual mm.info(default path) mm.info(filesize fname$) mkdir rmdir tested with ZMIM with minor tweaks. zmim directory must be in default path dim ss$(5) 'omit the length Sub main() Local i. old_dir$, state, s$ ss$(0)=mm.info(default path)+"zmim" ![]() Edited 2022-02-02 05:19 by matherp |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6220 |
I found the problem I was having with starting programs from the commandline. If you do a MODE change within about 500 mS of the program starting, it will exit (but only if started from the commandline) Adding a PAUSE 500 before the mode change allows the program to start reliably. Re comm ports: The old method I used was to test each port to see if it could be opened. for PortNumber = 1 to 64 test$=" COM"; PortNumber;" " if instr(" "+excludeCOM$+" ",test$)=0 then lpFileName$ = "\\.\COM"; PortNumber dwCreationDistribution = _OPEN_EXISTING hTemplateFile = _NULL calldll #kernel32, "CreateFileA", _ lpFileName$ as ptr, _ dwDesiredAccess as ulong, _ dwShareMode as ulong, _ lpSecurityAttributes as ulong, _ dwCreationDistribution as ulong, _ dwFlagsAndAttributes as ulong, _ hTemplateFile as ulong, _ hFileHandle as ulong if hFileHandle <> _INVALID_HANDLE_VALUE then pf=pf+1 portlist$(pf)=mid$(lpFileName$,5) calldll #kernel32, "CloseHandle", _ hFileHandle as ulong, _ result as long end if 'print lpFileName$,hFileHandle end if next PortNumber It's a bit slow but does work. Now I use the registry. count = Registry::CountSubValues(#HKEY_LOCAL_MACHINE, "HARDWARE\DEVICEMAP\SERIALCOMM") For n = 0 To count - 1 pName = Registry::ListSubValue(#HKEY_LOCAL_MACHINE, "HARDWARE\DEVICEMAP\SERIALCOMM", n) Port =Registry::ReadValue(#HKEY_LOCAL_MACHINE, "HARDWARE\DEVICEMAP\SERIALCOMM", pName) ;Debug pName+" , "+Port AddElement(myPorts()) myPorts() = Port found = found + 1 Next n I can provide the registry details in more detail (in PureBasic) if required. Jim VK7JH MMedit |
||||
Chopperp![]() Guru ![]() Joined: 03/01/2018 Location: AustraliaPosts: 1090 |
Re comm ports: The old method I used was to test each port to see if it could be opened. for PortNumber = 1 to 64 Jim Yes please Peter. That should be enough ![]() Brian ChopperP |
||||
twofingers Guru ![]() Joined: 02/06/2014 Location: GermanyPosts: 1530 |
![]() Why? ![]() Best regards Michael Edited 2022-02-02 08:44 by twofingers causality ≠ correlation ≠ coincidence |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10068 |
It's always amazing how the simplest thing can trip you up. Attached is the startup code for the program. It starts the clock thread then it delays starting the graphics thread until MMbasic is established because the graphics needs to know things like MM.VRES which is read from the options file on disk. However, because you were changing mode before the graphics started things went wrong. I'll put an interlock to delay executing Basic statements until say a second after the Basic thread starts int main(int argc, char* argv[]) { demo = new MMBasic; DWORD TimerID; HANDLE myTHandle = CreateThread(0, 0, mClock, NULL, 0, &TimerID); while (mSecTimer < 200) {} DWORD BasicID; HANDLE myHandle = CreateThread(0, 0, Basic, argv[1], 0, &BasicID); while (mSecTimer < 400) {} DWORD ScreenID; HANDLE mySHandle = CreateThread(0, 0, Screen, NULL, 0, &ScreenID); Edited 2022-02-02 08:45 by matherp |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6220 |
It's nice when the problem has an easy solution. I was lying in bed this morning and suddenly thought that it might be INKEY$ finding a stray character still in the buffer. That led me to the final discovery. Jim VK7JH MMedit |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6220 |
Yes please Peter. That should be enough ![]() Brian As Twofingers has shown, the com port number can grow (especially when you have devices with serial numbers). I started with checking a maximum of 32 to save time but users complained. The registry method has no such limitations, but it can get antivirus crapware to get alarmed. Jim VK7JH MMedit |
||||
Mixtel90![]() Guru ![]() Joined: 05/10/2019 Location: United KingdomPosts: 7513 |
Isn't the correct way to ask the windows sub-system for a port? That will return a port number for you to use. It might be a physical one or it might be a virtual USB one. When you provide a serial number windows will try to provide the same port number that it last used for that application. When you have a lot of port numbers it's because you've been using apps that don't provide a serial number so windows issues the next port number. I might be talking rubbish of course. :) Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
KD5ZXG Regular Member ![]() Joined: 21/01/2022 Location: United StatesPosts: 53 |
Looks like CTRL+V can now paste text from Windows clipboard to MMBASIC. Not sure how to copy MMBasic text back out to Windows clipboard??? F4 Mark F5 Copy F5 Paste still work only within MMBASIC. CTRL+C might be safe for EDIT, but definitely bad for RUN. Yet in EDIT, CTRL+C doesn't appear to copy F4 marked text. I also keep wanting to mark text with the mouse. Or type numbered lines and have them properly insert. Phantom limb syndrome... Edited 2022-02-02 17:57 by KD5ZXG |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10068 |
I will probably replace the editor with the one from the CMM2 eventually but not until a lot of other things are implemented. If/When I do this it will properly support the clipboard This will never happen. Line numbers are considered obsolete and the current limited support is the same for all modern versions of MMBasic |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10068 |
Tiny tweak to allow pentomino to run if you just patch out the GUI CURSOR commands (just run it and edit as you find the errors - there are about 4 lines need commenting out MMBasic.zip I've temporarily disabled ARGB and will make it an option that a user can enable when needed. This allows &Hnnnnnn to be used as working colours when not enabled. I've also put a short wait in MMBasic before it processes commands. Jim: please confirm this fixes your issue Edited 2022-02-02 18:27 by matherp |
||||
Chopperp![]() Guru ![]() Joined: 03/01/2018 Location: AustraliaPosts: 1090 |
Yes please Peter. That should be enough ![]() Brian As Twofingers has shown, the com port number can grow (especially when you have devices with serial numbers). I started with checking a maximum of 32 to save time but users complained. The registry method has no such limitations, but it can get antivirus crapware to get alarmed. Jim I do realise that the port numbers can grow. I check them every time I connect stuff particularly when using MMEdit to see what magical number comes up. (Device Manager and/or Serial Port Monitor Prog) What I wasn't sure of is if all the ports that Windows recognises will be active & usable under MMB4W or if there will be some restriction. I now assume that if I have 4 or more USB to TTL converters attached, that MMB4W will be able to use them concurrently (or simultaneously). I didn't know that there was a limit of 64 ports. I thought that there would have been a limit but I didn't think it was that high. I did wonder on occasions, how you determined what ports were available for MMEdit to connect to. Peter is doing a great job here along with all you helpers. Thanks. Brian ChopperP |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6220 |
MMB4W now starts reliably from MMEdit with MODE changes early in the program. Thanks. Jim VK7JH MMedit |
||||
![]() ![]() ![]() ![]() |
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |