MMB4L: MMBasic for Linux alpha release
Author | Message | ||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 4051 |
Hi folks, Well alpha 1 is ready and available for x86_64 and Raspberry Pi (armv7l): https://github.com/thwill1000/MMB4L I imagine there may be some teething troubles whilst we get the correct distributions built and installed. I'd appreciate it if you would let me know how you get on, please keep all MMB4L correspondence to this thread. EDIT: I can't promise to be as responsive as Peter is though. Best wishes, Tom Edited 2021-09-24 03:33 by thwill |
||||
lizby Guru Joined: 17/05/2016 Location: United StatesPosts: 3161 |
Excellent. Any hope for Armv6 as on the zero and zero-w or should what you put on github work? |
||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 4051 |
Hi @lizby, I'm not certain, but I think the 'armv7l' build "may just work" (TM), as when I was looking at the #defines the compiler was setting they all seemed to be ARM 6 rather than ARM 7 . Anyway would you mind giving it a go, and if it doesn't work then I'll dust off (literally) a Pi zero over the weekend and build a specific version for that. Best wishes, Tom Edited 2021-09-24 05:36 by thwill |
||||
Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 4292 |
Hi Tom, Will it run on any 64 bit linux that has nano editor available ? Or is this specific *BUNTU for the moment ? All my machines are 32 bit linux, and I could try to boot a live distro to test this out (some of the CPU's have 64bit , but I installed 32 bit to stay common over all machines). Thanks for the answer... Volhout |
||||
toml_12953 Guru Joined: 13/02/2015 Location: United StatesPosts: 340 |
Very nice! Is there a way to return to the Bash prompt? I didn't see one in the README. |
||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 4051 |
Hi @Volhout, I'm not 100% certain but I don't think the build is Ubuntu/Debian specific. I guess there might be an issue if the Linux distribution has too old a C runtime but I believe Linux is pretty resilient to that sort of thing (more so than Windoze). I guess I will be dusting off my old 32-bit DELL Lubuntu laptop over the weekend too then . You've got a Chromebook too haven't you, are you running Crostini, in which case what does "uname -a" have to say for itself. Best wishes, Tom |
||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 4051 |
3rd bullet-point in "How do I run it?" - type QUIT. Best wishes, Tom |
||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 4051 |
As a data-point the x86_64 build doesn't run on CentOS 7 (but looks like it would on CentOS 8) because it needs GLIBC_2.29. Best wishes, Tom |
||||
Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 4292 |
Hi Tom, I will try tomorrow on a newer live distro. The one 64bit machine I have throws an error: mmbasic: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.29' not found (required by mmbasic) Guess this machine is too old... (Xubuntu 18:04) Volhout |
||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 4051 |
I have uploaded an x86_64 build with a lower requirement (GLIBC_2.14): https://github.com/thwill1000/MMB4L/blob/main/binaries/mmb4l-2021.01.00-a1-x86_64-glibc-2.14.tgz GLIBC's are supposedly backward compatible. Best wishes, Tom Edited 2021-09-24 06:20 by thwill |
||||
lizby Guru Joined: 17/05/2016 Location: United StatesPosts: 3161 |
Looking good on a Pi-ZW: Linux armv7l MMBasic Ver 2021.01.00-a1 Copyright 2011-2021 Geoff Graham Copyright 2021 Thomas Hugo Williams > print "Hello, Pi" Hello, Pi > system "cat /proc/cpuinfo > /home/pi/info" > open "/home/pi/info" for input as #1 > do while not eof(#1): line input #1,a$: ?a$: loop processor : 0 model name : ARMv6-compatible processor rev 7 (v6l) BogoMIPS : 697.95 Features : half thumb fastmult vfp edsp java tls CPU implementer : 0x41 CPU architecture: 7 CPU variant : 0x0 CPU part : 0xb76 CPU revision : 7 Hardware : BCM2835 Revision : 9000c1 Serial : 000000005b3346ed > |
||||
lizby Guru Joined: 17/05/2016 Location: United StatesPosts: 3161 |
This is a kludge pending incorporation of pin I/O into the firmware (if that happens), but here is Digital output to pins on a Pi Zero W with MMB4L: Youtube: LEDs on and off ' PiIO.bas performs digital I/O with linux4MMB ' dim integer i,j,k,p(16)=(0,26,19,13,6,5,0,11,9,10,17,22,27,12,16,20,21) dim integer pState(16) dim integer q(4)=(0,14,15,18,23), dout=1, din=0 for i=1 to 16 setpin p(i),dout next for i=1 to 4 setpin p(i),din next i=1 do pState(i)=1-pState(i) ' toggle state cmd$="sudo echo '"+str$(pState(i))+"' > /sys/class/gpio/gpio"+str$(p(i))+"/value" ' print cmd$ system(cmd$) inc i: if i > 16 then i=1 pause 500 loop sub setpin(pinno as integer, pinmode as integer) local string dirname$, cmd$ dirname$="/sys/class/gpio/gpio"+str$(pinno) if not MM.INFO(EXISTS DIR dirname$) then cmd$="sudo echo '"+str$(pinno)+"' > /sys/class/gpio/export 2>/dev/null" ' print cmd$ system cmd$ endif if pinmode then cmd$="sudo echo 'out' > "+dirname$ else cmd$="sudo echo 'in' > "+dirname$ endif end sub A minor point: artifacts in screen when up-arrow to re-run command (but very happy to have that feature): > edit run > redit ererun > redit erun This uses BigMik's freeware 2x20 breakout Proto Board. Congratulations, Thwill. Nice work. I look forward to exploring. |
||||
lizby Guru Joined: 17/05/2016 Location: United StatesPosts: 3161 |
> list commands Call Case Case Else Cat Chdir Clear Close Cls Console Const Continue Copy CSub Cursor Data Dim Do Edit Else Else If ElseIf End End CSub End Function End If End Select End Sub EndIf Erase Error Execute Exit Exit Do Exit For Exit Function Exit Sub Files For Function GoSub GoTo If Inc Input IReturn Kill Let Line Input List Load Local LongString Loop Ls Math Memory Mkdir New Next On Open Option Pause Poke Print Quit Randomize Read Rem Rename Restore Return Rmdir Run Seek Select Case SetTitle Sort Static Sub System Timer Trace TrOff TrOn Wend While Total of 87 commands using 87 slots > list functions * + - / < << <= <> = =< => > >= >> \ ^ Abs( ACos( And As Asc( ASin( Atn( Bin$( Bound( Call( Choice( Chr$( Cint( Cos( Cwd$ Date$ Deg( Dir$( Else Eof( Eval( Exp( Field$( Fix( For Format$( GoSub GoTo Hex$( Inkey$ Input$( Instr( Int( Inv LCase$( LCompare( Left$( Len( LGetByte( LGetStr$( LInStr( LLen( Loc( Lof( Log( Math( Max( Mid$( Min( MM.CmdLine$ MM.Device$ MM.ErrMsg$ MM.Errno MM.HRes MM.Info( MM.Ver MM.VRes Mod Not Oct$( Or Peek( Pi Pos Rad( Rgb( Right$( Rnd Rnd( Sgn( Sin( Space$( Spc( Sqr( Step Str$( String$( Tab( Tan( Then Time$ Timer To UCase$( Until Val( While Xor Total of 104 functions using 104 slots |
||||
panky Guru Joined: 02/10/2012 Location: AustraliaPosts: 1101 |
Loaded into Mint 20.2 and working. Have nano working (v4.8) and can edit/save etc. but am a little confused with the instructions on using nano? Great job Tom, looking forward to following developments. Doug. |
||||
TassyJim Guru Joined: 07/08/2011 Location: AustraliaPosts: 6113 |
MAN NANO or (if you want more readable info: https://www.nano-editor.org/docs.php Jim |
||||
toml_12953 Guru Joined: 13/02/2015 Location: United StatesPosts: 340 |
If OPTION CASE functional (x86_64)? It doesn't seem to do anything when I set it to Upper. |
||||
toml_12953 Guru Joined: 13/02/2015 Location: United StatesPosts: 340 |
In the editor, My F1 and F2 seem to be reversed from the README. My F2 saves the file and F1 exits the editor. |
||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 4051 |
It's functional, it's just not useful . My understanding is that on the other 'mites (except CMM2) the current program is always stored (in the flash) in the tokenized form and this option controls how it is converted back into ASCII when the user EDITs or LISTs it. MMB4L and the CMM2 work differently in that they always EDIT and LIST the disk file, not the program stored in "flash". If you want to see what is in the "flash" type LIST FLASH and the keywords displayed will respect OPTION CASE. However note that irrespective of OPTION CASE all the variable names will be in upper-case, I don't think this happens with the other 'mites, it is probably an optimisation by Peter that MMB4L has inherited from the CMM2 code. In the future my intention is to throw away the somewhat adhoc preprocessor inherited from the CMM2 and replace it with one based on my own SPTools preprocessor. This will allow me to add proper pretty-printing / re-formatting to the language. Best wishes, Tom |
||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 4051 |
Right, I changed my mind a number of times about which should be which. Should I correct the nano resource file? or should I correct the README ? You can of course edit the nanorc file to personalise it for yourself. Best wishes, Tom |
||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 4051 |
Impressive, I'll have to find time to give that a go. It is my intention (at @robert.rozee's suggestion) to look into doing this with the pigpio library when I find some more time; I need to take a bit of a break now as I've been neglecting other things to get MMB4L out there. This is I believe a higher-level approach to what Peter did with the PiCRomite so may perhaps not run into the same issues. When I come to it I may need some hand-holding on the hardware/electronics side. I can't reproduce that on my Ubuntu build, what is the program that you are running ? It may perhaps be "messing" with the interpreter's concept of the current character position. Best wishes, Tom Edited 2021-09-24 20:11 by thwill |
||||