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 Linux (a possiblity - don't get too excited)
Page 4 of 5 | |||||
Author | Message | ||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 3848 |
Ah, thanks, not relevant to what I'm doing then. MMBasic for Linux works like the CMM2 and you "chain" by using RUN ... though perhaps it might also get a proper CHAIN command at some later point. Best wishes, Tom Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 3848 |
Hi folks, Geoff is giving me carte blanche (within reason) as to what version number "MMBasic for Linux" should claim to be and because I can't really decide myself I'd like some opinions. The intention is to try and track the (non-graphical / non hardware I/O) capabilities of MMBasic for CMM2 (currently version 5.07.01) but it already has some minor differences (it currently has LOAD) and a potential to diverge further whilst maintaining a common set of functionality. I'm wondering if rather than claiming to be 5.07.something I should just restart the numbering at 1.0.0 ? Edit: though that would rather scupper code that currently relies solely on Mm.Info(Version) to determine what capabilities are available, such code would also have to check Mm.Info(Device). Best wishes, Tom Edited 2021-09-07 22:03 by thwill Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
Rado Regular Member Joined: 27/11/2020 Location: CroatiaPosts: 59 |
Start With 11. Mac OS is now 11, Windows are 11, so there's a good reason to start with MMBasic4Linux 11 - it's a fresh, hot number, it's big and shows the maturity of your project, everyone is running 11 these days and so should you. On the other hand, if you're not in marketing and making big money pretty quick, maybe you should try to reflect the versioning close to original versioning - this would make sense if you're aspiring to evolve Linux port along the evolution of master version. That might make things easier to follow. If you're thinking about diverging significantly, it might be smart to start with the same version number and slowly diverge from that. |
||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 3848 |
I don't really want to start with a number higher than the CMM2, PicoMite, etc. as that would suggest it was more advanced ... it isn't. And my feeling is that starting with a number the same as or close to the CMM2, PicoMite, etc. is potentially confusing when the capabilities differ. LOL, there is no money here, I'm primarily doing this for my entertainment and because I believe it will allow me to develop software for the CMM2 and PicoMite faster - less SD card swapping and more powerful O/S tooling. Best wishes, Tom Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
Rado Regular Member Joined: 27/11/2020 Location: CroatiaPosts: 59 |
Ok, I was joking about 11. :) IDK, if you think that the same version would not reflect the true state, you could try different naming: MMB4L ver. 2021.9 (year/month) for a stable release, and apply minor subversions for any dev/beta work (2021.12-b1)? This is a neat and simple solution that is easy for the end user to remember, ties you up to monthly releases (I guess you wouldn't want to go any faster) and makes writing changelogs pretty readable (no need to think what happened between 3.20.14 and 3.20.17p1). |
||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 3848 |
Year based versioning isn't a bad idea actually, though I'd do year.minor.micro rather than encoding the month, so: 2021.0.0-a1 for the first alpha. 2021.0.0 for the first 2021 release 2021.0.3 for the third minor fix to the 2021 release 2021.1.0 for the second 2021 release Any other views? Does it matter that someone writing code for multiple platforms might have to check both "Device" and "Version" because the version numbers for different devices are not aligned ? - not that I'm sure there is a correct solution to that. Best wishes, Tom Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
robert.rozee Guru Joined: 31/12/2012 Location: New ZealandPosts: 2290 |
personally, i think that keeping geoff's numbering is going to be far less confusing for everyone. then you can periodically pull in any updates from geoff's source and bump up your version number to match. if you feel there are likely to be sub-releases in between geoff's version number changing, a simple solution would be to just reflect that in the signon banner; perhaps a line reading "release date: 20210908". cheers, rob :-) |
||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 3848 |
That would be ideal, but I'm pulling in from two different sources, the code that Geoff maintains is version 5.05 whereas that which Peter maintains is version 5.07 - the core mechanics (not just the catalogue of commands/functions) of Peter's code has diverged somewhat from Geoff's to support some of the CMM2's advanced features and likewise I've had to do the same in order to imitate the CMM2. If I were going to choose between those two versions then 5.07 would be the most accurate, but what happens when Peter and I have different minor release schedules ? That's why I'm contemplating a break from the original versioning scheme. Best wishes, Tom Edited 2021-09-08 00:48 by thwill Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 5735 |
How about starting with MMB4L 5.07.L00 (or whatever the current micro revision for the CMM2 is). You can change the Lnn to whatever you like or keep it in step with the main micro releases if you like. Either way, you can (try to) keep up with the major and minor releases following the normal numbering system. Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 3848 |
That's a possibility Mick, though not sure how it will work with Mm.Info(Version) which returns a FLOAT representation of the version number. Best wishes, Tom Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 5735 |
Just don't return the micro revision - just 5.07 I'm lazy... :) Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 3848 |
It is not my intention to bloat MMB4L with lots of extensions to MMBasic but I got distracted from my main TODO list and had a bit of a play yesterday evening. Video shows integration with the 'nano' editor and the new CONSOLE command that I've added specifically for the Linux version. https://youtu.be/oZCO5qpnAAA Screenshot: Program (MMB4L only): ' Demonstration of CONSOLE commands for MMB4L Option Base 0 Option Default Float Option Explicit On Dim cols%, rows% Console SetTitle "Mandelbrot" Dim count%, k%, redraw%, x%, y% update_display() Do k% = Asc(Inkey$) Select Case k% Case &h80: Inc y%, -1 : redraw% = 1 Case &h81: Inc y%, 1 : redraw% = 1 Case &h82: Inc x%, -1 : redraw% = 1 Case &h83: Inc x%, 1 : redraw% = 1 End Select Inc count% If count% = 1000 Then redraw% = 1 If redraw% Then update_display() redraw% = 0 count% = 0 EndIf Loop Sub update_display() If size_changed%() Then draw_mandelbrot() If x% < 0 Then x% = 0 If x% >= cols% Then x% = cols% - 1 If y% < 0 Then y% = 0 If y% >= rows% Then y% = rows% - 1 Local s$ = "Rows: " + Str$(rows%) + ", Cols: " + Str$(cols%) Cat s$, ", x: " + Str$(x%) + ", y: " + Str$(y%) s$ = Left$(s$, cols%) s$ = s$ + Space$(Max(0, cols% - Len(s$))) Console HideCursor Console SetCursor 0, rows% - 1 Console Foreground White Console Background Black Print s$; Console SetCursor x%, y% Console ShowCursor End Sub Sub draw_mandelbrot() Local c%, it%, max_it%, x, x0, y, y0, xtemp Console Reset Console HideCursor Console Clear For x0 = -2 To 2 Step .01 For y0 = -1.5 To 1.5 Step .01 x = 0 y = 0 it% = 0 max_it% = 7 Do While (x * x + y * y <= (2 * 2) AND it% < max_it%) xtemp = x * x - y * y + x0 y = 2 * x * y + y0 x = xtemp Inc it% Loop c% = Choice(it% = max_it%, 0, it%) Console Background c% Console SetCursor (cols% / 4) * (x0 + 2), (rows% / 3) * (y0 + 1.5) Print " "; Next If size_changed%() Then x0 = -2 Console Reset Console Clear EndIf Next End Sub Function size_changed%() Local new_cols%, new_rows% Console GetSize new_rows%, new_cols% size_changed% = (new_cols% <> cols%) Or (new_rows% <> rows%) cols% = new_cols% rows% = new_rows% End Function Best wishes, Tom Edited 2021-09-09 23:35 by thwill Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 5735 |
Very nice! :) Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
lizby Guru Joined: 17/05/2016 Location: United StatesPosts: 3016 |
Sweet. I'm liking "console". PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed |
||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 3848 |
Hi folks, I think I'm within sight of an alpha release as everything I need to run my catalogue of programs is implemented; including using CSUBs to store arbitrary binary data which is required to run SAAINT in MMBasic: https://www.youtube.com/watch?v=Ol2w63K7BvQ I still want to copy over Peter's MATH commands/functions from the CMM2 but that should just be a case of copy & paste - I don't suppose anyone has any simple test programs for these? ideally that validate the results against some known numbers, otherwise it's going to be "change & pray" as I don't really have the time or knowledge to write unit-tests for them all. Then I need to compile up on Raspberry Pi - I've already had a preliminary go at this and it "just worked" (TM). And finally I guess I'll need to knock up a preliminary README. With a bit of luck all be done by the end of the weekend with x86_64 and Raspberry Pi 32-bit downloads. Best wishes, Tom Edited 2021-09-17 22:43 by thwill Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 3552 |
Hi Will, I am using some MATH commands in my mains voltage analyzer. I may be able to cludge some test program together. I guess you are looking at something that gives a pass-fail in the end of each detail test, and a final verdict at the end. It is quite simple to write something up to cover: - math zero - math add - math scale - math fft - math inverse-fft - math magnitude fft - math max - math min - math mean - math median - math sd - math inverse Some of these commands support multiple dimensions or .."any number of dimensions". That will be harder to cover that. Maybe Peter has a test set for this already. It is harder (for me at least) to write something on the 3d operations. I do not understand the theory behind it so testing it may be out of my league. Maybe you should simply run the 3D rotating football. Regards, Volhout Maybe you can share an example of one of your basic tests in the test suite so I can use it as a template. PicomiteVGA PETSCII ROBOTS |
||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 3848 |
Tom Correct, and if you could do so that would be brilliant. Even if I don't have coverage of all the commands/functions something is better than nothing. If it exists in a resuable fashion then I'm sure he will offer it. Unfortunately the first (all?) versions of MMB4L support the console only, so unless someone wants to produce an incredibly low-res ANSI escape code version then that's no good to me . Unfortunately they involve a lot of framework code, so whilst the main .bas file for each suite might be relatively simple (if often longwinded) ... ' Copyright (c) 2021 Thomas Hugo Williams ' License MIT <https://opensource.org/licenses/MIT> ' For Colour Maximite 2, MMBasic 5.07 Option Explicit On Option Default None Option Base InStr(Mm.CmdLine$, "--base=1") > 0 #Include "../src/splib/system.inc" #Include "../src/splib/array.inc" #Include "../src/splib/list.inc" #Include "../src/splib/string.inc" #Include "../src/splib/file.inc" #Include "../src/splib/vt100.inc" #Include "../src/sptest/unittest.inc" Const BASE% = Mm.Info(Option Base) add_test("test_append") add_test("test_clear") add_test("test_copy") add_test("test_concat") add_test("test_lcase") add_test("test_lcompare") add_test("test_left") add_test("test_lgetbyte") add_test("test_lgetstr") add_test("test_linstr") add_test("test_llen") add_test("test_load") add_test("test_mid") add_test("test_print") add_test("test_replace") add_test("test_resize") add_test("test_right") add_test("test_setbyte") add_test("test_trim") add_test("test_ucase") If InStr(Mm.CmdLine$, "--base") Then run_tests() Else run_tests("--base=1") End Sub setup_test() End Sub Sub teardown_test() End Sub Sub test_append() Local array%(1000) Local addr% = Peek(VarAddr array%()) LongString Append array%(), "Hello World" assert_hex_equals(11, array%(BASE% + 0)) assert_hex_equals(Asc("H"), Peek(Byte addr% + 8)) assert_hex_equals(Asc("e"), Peek(Byte addr% + 9)) assert_hex_equals(Asc("l"), Peek(Byte addr% + 10)) assert_hex_equals(Asc("l"), Peek(Byte addr% + 11)) assert_hex_equals(Asc("o"), Peek(Byte addr% + 12)) assert_hex_equals(Asc(" "), Peek(Byte addr% + 13)) assert_hex_equals(Asc("W"), Peek(Byte addr% + 14)) assert_hex_equals(Asc("o"), Peek(Byte addr% + 15)) assert_hex_equals(Asc("r"), Peek(Byte addr% + 16)) assert_hex_equals(Asc("l"), Peek(Byte addr% + 17)) assert_hex_equals(Asc("d"), Peek(Byte addr% + 18)) assert_hex_equals(&h00, Peek(Byte addr% + 19)) End Sub Sub test_clear() Local array%(100) LongString Append array%(), "Hello World" LongString Clear array%() assert_hex_equals(&h0, array%(BASE% + 0)); End Sub Sub test_copy() Local src%(100), dest%(100) LongString Append src%(), "Hello World" LongString Copy dest%(), src%() assert_string_equals("Hello World", LGetStr$(dest%(), 1, LLen(dest%()))) End Sub Sub test_concat() Local src%(100), dest%(100) LongString Append src%(), "Hello World" LongString Concat dest%(), src%() LongString Concat dest%(), src%() assert_string_equals("Hello WorldHello World", LGetStr$(dest%(), 1, LLen(dest%()))) End Sub Sub test_lcase() Local array%(100) LongString Append array%(), "Hello World" LongString LCase array%() assert_string_equals("hello world", LGetStr$(array%(), 1, LLen(array%()))) End Sub Sub test_lcompare() Local array1%(100), array2%(100) LongString Append array1%(), "Hello World" LongString Append array2%(), "Hello World" assert_int_equals(0, LCompare(array1%(), array2%())) LongString Clear array2%() LongString Append array2%(), "Hello" assert_int_equals(1, LCompare(array1%(), array2%())) LongString Clear array2%() LongString Append array2%(), "Hello World, Goodbye Mars" assert_int_equals(-1, LCompare(array1%(), array2%())) End Sub Sub test_left() Local dest%(100), src%(100) LongString Append src%(), "Hello World" LongString Left dest%(), src%(), 5 assert_int_equals(5, LLen(dest%())) assert_string_equals("Hello", LGetStr$(dest%(), 1, LLen(dest%()))) End Sub Sub test_lgetbyte() Local array%(100) LongString Append array%(), "Hello World" assert_hex_equals(Asc("H"), LGetByte(array%(), BASE% + 0)) assert_hex_equals(Asc("e"), LGetByte(array%(), BASE% + 1)) assert_hex_equals(Asc("l"), LGetByte(array%(), BASE% + 2)) assert_hex_equals(Asc("l"), LGetByte(array%(), BASE% + 3)) assert_hex_equals(Asc("o"), LGetByte(array%(), BASE% + 4)) assert_hex_equals(Asc(" "), LGetByte(array%(), BASE% + 5)) assert_hex_equals(Asc("W"), LGetByte(array%(), BASE% + 6)) assert_hex_equals(Asc("o"), LGetByte(array%(), BASE% + 7)) assert_hex_equals(Asc("r"), LGetByte(array%(), BASE% + 8)) assert_hex_equals(Asc("l"), LGetByte(array%(), BASE% + 9)) assert_hex_equals(Asc("d"), LGetByte(array%(), BASE% + 10)) assert_hex_equals(&h00, LGetByte(array%(), BASE% + 11)) End Sub Sub test_lgetstr() Local array%(100) LongString Append array%(), "Hello World" assert_string_equals("Hello", LGetStr$(array%(), 1, 5)) assert_string_equals(" World", LGetStr$(array%(), 6, 6)) End Sub Sub test_linstr() Local array%(100) LongString Append array%(), "Hello World" assert_int_equals(1, LInStr(array%(), "Hell")) assert_int_equals(8, LInStr(array%(), "o", 6)) assert_int_equals(0, LInStr(array%(), "z")) End Sub Sub test_llen() Local array%(100) LongString Append array%(), "Hello World" assert_int_equals(11, LLen(array%())) End Sub Sub test_load() Local dest%(100) Local src$ = "Hello World" LongString Load dest%(), 5, src$ assert_string_equals("Hello", LGetStr$(dest%(), 1, LLen(dest%()))) End Sub Sub test_mid() Local dest%(100), src%(100) LongString Append src%(), "Hello World" LongString Mid dest%(), src%(), 3, 5 assert_string_equals("llo W", LGetStr$(dest%(), 1, LLen(dest%()))) End Sub Sub test_print() Local array%(100) LongString Append array%(), "Hello World" Open "/tmp/tst_longstring-test_print.txt" For Output As #1 LongString Print #1, array%() Close #1 Open "/tmp/tst_longstring-test_print.txt" For Input As #1 Local s$ Line Input #1, s$ assert_string_equals("Hello World", s$) assert_true(Eof(#1)) Close #1 End Sub Sub test_replace() Local array%(100) LongString Append array%(), "Hello World" LongString Replace array%(), "Mars", 7 assert_string_equals("Hello Marsd", LGetStr$(array%(), 1, LLen(array%()))) End Sub Sub test_resize() Local array%(100 + BASE) ' 8 bytes for the size and 800 bytes for the data LongString Append array%(), "Hello World" LongString Resize array%(), 4 assert_string_equals("Hell", LGetStr$(array%(), 1, LLen(array%()))) LongString Resize array%(), 0 assert_int_equals(0, LLen(array%())) LongString Resize array%(), 800 assert_int_equals(800, LLen(array%())) On Error Skip 1 LongString Resize array%(), 801 assert_raw_error("801 is invalid (valid is 0 to 800)") End Sub Sub test_right() Local dest%(100), src%(100) LongString Append src%(), "Hello World" LongString Right dest%(), src%(), 5 assert_string_equals("World", LGetStr$(dest%(), 1, LLen(dest%()))) End Sub Sub test_setbyte() Local array%(100) LongString Append array%(), "Hello World" LongString SetByte array%(), BASE% + 1, Asc("X") LongString SetByte array%(), BASE% + 3, Asc("Y") LongString SetByte array%(), BASE% + 5, Asc("Z") assert_string_equals("HXlYoZWorld", LGetStr$(array%(), 1, LLen(array%()))) End Sub Sub test_trim() Local array%(100) LongString Append array%(), "Hello World" LongString Trim array%(), 3 assert_string_equals("lo World", LGetStr$(array%(), 1, LLen(array%()))) End Sub Sub test_ucase() Local array%(100) LongString Append array%(), "Hello World" LongString UCase array%() assert_string_equals("HELLO WORLD", LGetStr$(array%(), 1, LLen(array%()))) End Sub If you are interested in the details you can look here https://github.com/thwill1000/cmm2-sptools/tree/develop-2.0.0/src/sptest and here https://github.com/thwill1000/cmm2-sptools/tree/develop-2.0.0/firmware-tests I'd be more than happy to just have some code that just prints a message and exits/errors if a calculated value differs from an expected value and then I will massage it into the format for automated testing. Best wishes, Tom Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
lizby Guru Joined: 17/05/2016 Location: United StatesPosts: 3016 |
Will the command set include the SYSTEM command (I hope)? PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed |
||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 3848 |
Yup, that's present and tested, inherited from MMBasic for DOS - thanks Geoff. Linux x86_64 MMBasic Ver 2021.0.0-a1 Copyright 2011-2021 Geoff Graham Copyright 2021 Thomas Hugo Williams > home$ = MM.Info(EnvVar "HOME") > system("ls " + home$) Desktop Documents Downloads github Music Pictures Public snap Templates Videos > system("ls " + home$ + " > ~/out.txt") > system("ls " + home$) Desktop Documents Downloads github Music out.txt Pictures Public snap Templates Videos > system("more " + home$ + "/out.txt") Desktop Documents Downloads github Music out.txt Pictures Public snap Templates Videos > Best wishes, Tom Edited 2021-09-18 01:25 by thwill Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
lizby Guru Joined: 17/05/2016 Location: United StatesPosts: 3016 |
Will the command set include the SYSTEM command (I hope)? PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed |
||||
Page 4 of 5 |
Print this page |