Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 08:54 11 May 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : MMBasic for Windows - alphas

     Page 11 of 12    
Author Message
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4251
Posted: 10:19am 25 Feb 2022
Copy link to clipboard 
Print this post

Good morning Peter,

Two bugs/inconsistencies, one request and one question this morning:

1. Bug 1:

CMM2:

> Print Mm.Info(FileSize "dir-that-exists")
-2
> Print Mm.Info(FileSize "dir-that-exists/")
Invalid file specification
> Print Mm.Info(FileSize "dir-that-exists\")
Invalid file specification
> Print Mm.Info(FileSize "file-that-exists.txt")
6378
> Print Mm.Info(FileSize "file-that-does-not-exist.txt")
-1

MMB4W:

> Print Mm.Info(FileSize "dir-that-exists")
0
> Print Mm.Info(FileSize "dir-that-exists/")
-1
> Print Mm.Info(FileSize "dir-that-exists\")
-1
> Print Mm.Info(FileSize "file-that-exists.txt")
6378
> Print Mm.Info(FileSize "file-that-does-not-exist.txt")
-1


Note that I don't care what the "answer" is, just that it is consistent across the CMM2, PicoMite, MMB4W and MMB4L ... well actually it will never be completely consistent for MMB4L since directories have a "size" (usually 4096) in Linux.

2. Bug 2:

Run this on the CMM2 and MMB4W:

Open "foo.txt" For Output As #1
Print #1, "Hello World"
Print #1, "Goodbye World"
Close #1

Open "foo.txt" For Input As #1
Print Eof(#1)
s$ = Input$(255, #1)
Print Eof(#1)
Close #1


The output on the CMM2:
0
1


The output on MMB4W:
0
-1


I think the returned value for EOF should be 1 as MMBasic generally uses 1 for TRUE.

3. The request:

Could we please have (on all platforms) a MM.INFO(EXISTS "foo") that returns 1 if "foo" exists and is a file OR a directory.

4. The question:

Am I correct in thinking MMB4W allows more than 10 open files unlike the other ports, and if so how many?

Best wishes,

Tom
Edited 2022-02-25 20:20 by thwill
MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10067
Posted: 10:41am 25 Feb 2022
Copy link to clipboard 
Print this post

Think they are all done including the request


MMBasic.zip

The question - not sure if there is a limit in windows but I've allowed for 64 com ports and 64 files

Currently working on porting the socket support from Pi-Cromite. Have you included this in MMB4L?
Edited 2022-02-25 20:42 by matherp
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4251
Posted: 10:45am 25 Feb 2022
Copy link to clipboard 
Print this post

  matherp said  Think they are all done including the request


Thanks Peter, will give it a spin on Monday morning ... I want to grab a few hours this weekend to work on MMB4L.

  Quote  Currently working on porting the socket support from Pi-Cromite. Have you included this in MMB4L?


Not yet Peter and it isn't slated for the first non-alpha/beta release. I can't keep up with you and am not even trying I would however be grateful if I can cannibalise whatever you do for MMB4W.

Best wishes,

Tom
Edited 2022-02-25 20:51 by thwill
MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10067
Posted: 11:03am 25 Feb 2022
Copy link to clipboard 
Print this post

  Quote   I would however be grateful if I can cannibalise whatever you do for MMB4W.


The Pi-Cromite code should work out of the box for you - I need to make changes for windows
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4251
Posted: 11:37am 25 Feb 2022
Copy link to clipboard 
Print this post

  matherp said  
  Quote   I would however be grateful if I can cannibalise whatever you do for MMB4W.

The Pi-Cromite code should work out of the box for you - I need to make changes for windows


Thanks Peter, I had assumed as much but you never know.

Best wishes,

Tom
MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
lizby
Guru

Joined: 17/05/2016
Location: United States
Posts: 3310
Posted: 01:08pm 25 Feb 2022
Copy link to clipboard 
Print this post

  PeterB said  Is there a place in this world for a device to convert USB into multiple I/O pins?

Picomite I/O serial client Posted yesterday. More to come.
PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed
 
Plasmamac

Guru

Joined: 31/01/2019
Location: Germany
Posts: 572
Posted: 01:58pm 25 Feb 2022
Copy link to clipboard 
Print this post

Hi matherp , today i have testet MMBasic4W on 16 win 10 Pc , most diffent hardware.
Demox runs fine !  Btw its the only software i know which play modfiles without extra dll such like fmod.
Edited 2022-02-25 23:59 by Plasmamac
Plasma
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10067
Posted: 02:20pm 25 Feb 2022
Copy link to clipboard 
Print this post

  Quote  Hi matherp , today i have testet MMBasic4W on 16 win 10 Pc , most diffent hardware.
Demox runs fine !  Btw its the only software i know which play modfiles without extra dll such like fmod.


   
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10067
Posted: 04:04pm 25 Feb 2022
Copy link to clipboard 
Print this post

V5.07.03pa12


MMBasic.zip

Fixes bug in F2 leaving the editor

NEW FUNCTIONALITY

TCP command as per Pi-Cromite
GETIP$() function as per Pi-Cromite
SYSTEM command as per Pi-Cromite
JSON$ function

Pi-cromite Manual.pdf

This now allows you to do things like download the weather. You will need to substitute your own openweathermap.org APIKEY$ and a local PLACEID$ in the attached to make it work for you.

Option explicit
Option default none
Dim a$,b$,c$
Dim integer i,j,rlen
Dim m%(4000)
Dim PLACEID$="2638878"
Dim APIKEY$="myAPIkey"
'
' get the IP address of openweathermap and open a client connection to it
'
a$="api.openweathermap.org"
TCP client a$,80
'
' construct the request for a weather report and send it
'
b$= "GET /data/2.5/weather?id="+PLACEID$+"&APPID="+APIKEY$
b$=b$+" HTTP/1.0"+Chr$(13)+Chr$(10)+Chr$(13)+Chr$(10)
TCP send b$
'
'set up a longstring variable and read the return message into it
'
LongString clear m%()
Do
TCP receive c$
If c$<>"" Then LongString append m%(),c$
Loop While c$<>""
'
' trim off the HTTP header
'
LongString trim m%(),LInStr(m%(),"{")-1
rlen=LLen(m%())
'
' process the message, in this case just print it out
'
i=1
Do While rlen>0
If rlen>240 Then
j=240
Else
j=rlen
EndIf
rlen=rlen-j
Print LGetStr$(m%(),i,j);
i=i+j
Loop
Print ""
TCP close
Print "Weather for "+json$(m%(),"name")
Print "Temperature is ",val(json$(m%(),"main.temp"))-273
Print "Pressure is ",json$(m%(),"main.pressure")
Print json$(m%(),"weather[0].description")


Edited 2022-02-26 02:12 by matherp
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4251
Posted: 04:19pm 25 Feb 2022
Copy link to clipboard 
Print this post

  matherp said  V5.07.03pa12


Nice.

FYI and take them or leave them I added a couple of extensions to JSON$ and SYSTEM for MMB4L, you can see more here:

https://github.com/thwill1000/mmb4l-src/blob/main/linux-src/functions/fun_json.c
https://github.com/thwill1000/mmb4l-src/blob/main/linux-src/commands/cmd_system.c

Sorry folks the last two links are only accessible to collaborators on that GitHub project, however I've recently cleared it with Geoff and from alpha 4 MMB4L will be going open-source and that project will become public.

Best wishes,

Tom
MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 7505
Posted: 04:36pm 25 Feb 2022
Copy link to clipboard 
Print this post

Latest version of the doc. I tried to export as PDF again but the converter complained, so it's zipped RTF again.

MMBasic For Windows 220225.zip
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
lizby
Guru

Joined: 17/05/2016
Location: United States
Posts: 3310
Posted: 06:03pm 25 Feb 2022
Copy link to clipboard 
Print this post

  Mixtel90 said  Latest version of the doc. I tried to export as PDF again but the converter complained, so it's zipped RTF again.

MMBasic For Windows 220225.zip

Thanks for that. I just printed it to "Microsoft Print to PDF".

MMBasic_For_Windows.pdf
PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10067
Posted: 06:23pm 25 Feb 2022
Copy link to clipboard 
Print this post

  Quote  Latest version of the doc.


Forgot to mention in dispatches, mp3, flac and wav playback now support multiple sampling frequencies. FLAC tested up to 192k @ 24-bit
 
Plasmamac

Guru

Joined: 31/01/2019
Location: Germany
Posts: 572
Posted: 07:48pm 25 Feb 2022
Copy link to clipboard 
Print this post

no picromite here so i have to ask :
is it ok what  

a$=  GETIP$("www.google.com")
end

will show the ip without print a$ ?
Plasma
 
Goksteroo
Senior Member

Joined: 15/03/2021
Location: Australia
Posts: 114
Posted: 12:11am 26 Feb 2022
Copy link to clipboard 
Print this post

Issues with PAUSE... can be inaccurate with values <50, and very inaccurate with values <10 and let's not mention <1! This little test programme will show the issues better than I could describe them. Runs on CMM2 with results the same for using PAUSE or DO/LOOPs.

Came about when I was using PAUSE to make a scrolling page smooth (no GETSCANLINE in MMB4W) and couldn't get consistency until I used the DO/LOOP approach.
do
cls
td=0
tp=0
input "Delay wanted:";d
for i=1 to 10
print
timer=0
do
loop while timer<d
t=timer
inc td,t
print "Do/Loop: ";d,t
timer=0
pause d
t=timer
inc tp,t
print "Pause:   ";d,t
next
print "Do/Loop average: ";td/10
print "Pause average:   ";tp/10
print:print "Press [SPACE]"
do
loop while inkey$<>" "
loop
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6220
Posted: 05:58am 26 Feb 2022
Copy link to clipboard 
Print this post

  Goksteroo said  Issues with PAUSE... can be inaccurate with values <50, and very inaccurate with values <10 and let's not mention <1!

It is a known problem.
Timer is very accurate but PAUSE and SETTICK not so good as you have seen.
For long pauses, if critical, I suggest start with a pause a bit shorter than required then use timer in a loop to sneak up on the target time.

For SETTICK, I found that cancelling the settick timer and re-starting it every time the tick fires gives a more consistent result. If you leave the SETTICK repeating, you can get a very short time interval.

Hopefully, a resolution can be found soon. Multitasking operating systems make life difficult.

Jim
VK7JH
MMedit
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10067
Posted: 08:48am 26 Feb 2022
Copy link to clipboard 
Print this post

  Quote  Timer is very accurate but PAUSE and SETTICK not so good as you have seen.

I think I can fix pause but settick will take a bit longer - watch this space
Edited 2022-02-26 18:51 by matherp
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10067
Posted: 10:16am 26 Feb 2022
Copy link to clipboard 
Print this post

V5.07.03a13



MMBasic.zip


Rework of pause and settick

Test program

option milliseconds on
settick 1000,myint
timer=0
do
 pause 5000
 print time$
loop
sub myint
 static int lasttime=timer
 print timer-lasttime
 lasttime=timer
end sub

Edited 2022-02-26 20:20 by matherp
 
Michal
Senior Member

Joined: 02/02/2022
Location: Poland
Posts: 125
Posted: 01:28pm 26 Feb 2022
Copy link to clipboard 
Print this post

Hi matherp,

Or maybe SQLite should be included?
Then one could get DATA from text fields as with BASIC DATA with arguments separated by comma.
Using simple SQL queries

Michal
Edited 2022-02-26 23:29 by Michal
 
lizby
Guru

Joined: 17/05/2016
Location: United States
Posts: 3310
Posted: 01:45pm 26 Feb 2022
Copy link to clipboard 
Print this post

For the last two mmb4w firmware updates, I am denied access to copy to a folder which is in my path. I'm the administrator--when I click to give administrator rights, still denied. I copied to a different folder, opened an "Administrator command line" (DOS with administrator rights) and tried to copy to the folder I wanted, but get this:

C:\WINDOWS\system32>copy \dl\micromite\_mmb4w\mmbasic.exe \bin
Access is denied.
       0 file(s) copied.

C:\WINDOWS\system32>


What has changed (there has been a Win10 update on my laptop since this last succeeded), and what more can I do? (Who has more rights on my laptop than I as administrator do? ... grrr)
PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed
 
     Page 11 of 12    
Print this page
The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025