![]() |
Forum Index : Microcontroller and PC projects : CMM2: bug in 5.07 - I'm not deliberately looking, honest
Page 1 of 2 ![]() ![]() |
|||||
Author | Message | ||||
thwill![]() Guru ![]() Joined: 16/09/2019 Location: United KingdomPosts: 4311 |
I truly wish I hadn't found this, at least Peter can take solace in that it is probably one for Geoff: > 480MHz Colour Maximite 2 G2 MMBasic Version 5.07.00RC4 Copyright 2011-2021 Geoff Graham Copyright 2016-2021 Peter Mather > list "do_loop_bug.bas" Option Base 0 Option Default None Option Explicit On foo(1) Sub foo(i%) Do While i% < 2 foo(i% + 1) Loop End Sub > run "do_loop_bug.bas" Error in line 10: LOOP without a matching DO Best wishes, Tom MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10310 |
I think this is a known issue where you can't use do loops in recursion in this way - certainly the MM2 displays the same symptoms Edited 2021-07-02 20:33 by matherp |
||||
thwill![]() Guru ![]() Joined: 16/09/2019 Location: United KingdomPosts: 4311 |
Thanks Peter, I thought it looked familiar. Note that to avoid infinite looping foo() should be written: Sub foo(i%) Do While i% < 2 foo(i% + 1) Inc i% Loop End Sub ... which still shows the same problem. Best wishes, Tom MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
Geoffg![]() Guru ![]() Joined: 06/06/2011 Location: AustraliaPosts: 3292 |
As Peter said, it is a known issue. BASIC is not really suited to recursion. To allow recursion the current state of the program needs to be pushed onto a stack and, given the way BASIC works, that is a lot of data. I used some tricks to allow limited recursion but there are problems. In the Micromite manual I warn against recursing within loops and I should have copied that text across to the CMM2 version. Geoff BTW, I know that "recursing" is not a proper word ![]() Edited 2021-07-02 21:03 by Geoffg Geoff Graham - http://geoffg.net |
||||
thwill![]() Guru ![]() Joined: 16/09/2019 Location: United KingdomPosts: 4311 |
Thanks Geoff, Of course it is, every time I ask Peter for a feature and he says "No" I am "re-cursing" him ![]() Just kidding, Tom Edited 2021-07-02 20:57 by thwill MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
Lodovik![]() Regular Member ![]() Joined: 17/05/2021 Location: CanadaPosts: 41 |
Hi, I have one to report too, discovered by mistake. When I type MODE and press ENTER, my CMM2 freezes up to the point I must do a power cycle. I'm on official 5.07.00 with a 480 MHz unit with no extensions, a pre-assembled Gen1 CMM2 I bought on Micromite.org a month ago. Thanks. |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10310 |
I've added it to the known bug list https://geoffg.net/Downloads/Maximite/CMM2_Current_Bug_List.txt Will fix in the next release but the workaround is obvious ![]() |
||||
William Leue Guru ![]() Joined: 03/07/2020 Location: United StatesPosts: 405 |
When I want to implement an algorithm that is fundamentally recursive, and where changing it to purely iterative would substantially "uglify" a nice clean recursion, I just use an explicit stack and push/pop the variables that would change in a real recursion. It's easy, reasonably efficient, and avoids the tight recursion limit. -Bill |
||||
Geoffg![]() Guru ![]() Joined: 06/06/2011 Location: AustraliaPosts: 3292 |
Push/Pop is worth thinking about. There would still be limitations but with the great amount of memory on the CMM2 it might work (but probably not on the Micromites). I will look into it. Geoff Geoff Graham - http://geoffg.net |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10310 |
Sounds interesting. For the CMM2 I would recommend using VAR PUSH and VAR POP as the commands as I don't have two command slots free (or even one!) |
||||
Grogster![]() Admin Group ![]() Joined: 31/12/2012 Location: New ZealandPosts: 9610 |
Recursion: "If we had an index file, we could look it up in the index file under index file!" Smoke makes things work. When the smoke gets out, it stops! |
||||
MauroXavier Guru ![]() Joined: 06/03/2016 Location: BrazilPosts: 303 |
The MEMORY command freeze my CMM2 G2 in any option configuration, even after reflashing the firmware with the option to clear all flash memory. |
||||
thwill![]() Guru ![]() Joined: 16/09/2019 Location: United KingdomPosts: 4311 |
Just vanilla "MEMORY" ? Works on my G2 (prototype): > 480MHz Colour Maximite 2 G2 MMBasic Version 5.07.00 Copyright 2011-2021 Geoff Graham Copyright 2016-2021 Peter Mather > option list CURRENT VGA mode 800x600 RGB332 CURRENT DISPLAY 50,100 OPTION USBKEYBOARD UK, 1 OPTION RAM ON OPTION KEYBOARD REPEAT 200,50 OPTION SEARCH PATH /bin/ OPTION F11 chdir "/zmim/src"<crlf> OPTION F12 chdir "/sptools/src"<crlf> > memory Program: 0K ( 0%) Program (0 lines) 516K (100%) Free Data: 0K ( 0%) 0 Variables 0K ( 0%) General 24800K (100%) Free Best wishes, Tom Edited 2021-07-06 03:47 by thwill MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10310 |
Just downloaded the binary from Geoff's site and programmed over UART on identical H/W and it works fine. Try OPTION RESET, if that doesn't work then I suggest you re-program with flash erase all first. Then option reset, then try again UPDATE: if the problem persists then please type VAR CLEAR and then MEMORY - what happens? Tom: please try var save/restore on your G2 with and without power cycling Edited 2021-07-06 04:56 by matherp |
||||
thwill![]() Guru ![]() Joined: 16/09/2019 Location: United KingdomPosts: 4311 |
I don't know what I'm looking for, and I didn't find it. All looks good to me. Best wishes, Tom MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
MauroXavier Guru ![]() Joined: 06/03/2016 Location: BrazilPosts: 303 |
After a VAR CLEAR the MEMORY commands works ok, but after a reset I need to use always VAR CLEAR otherwise the system hangs again after the MEMORY command. Edited 2021-07-07 09:56 by MauroXavier |
||||
Arno Newbie ![]() Joined: 19/09/2020 Location: GermanyPosts: 15 |
I have the same problem as MauroXavier on one of two G2 systems. Both systems run the same MMBasic Version 5.07.00. Arno |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10310 |
Mauro and Arno Please could you try the attached experimental version. You won't get the lockup with the memory command. This is easy to fix but the question is does VAR SAVE and VAR RESTORE work? So please: A=10 VAR SAVE A CPU RESTART VAR RESTORE ? A You should get 10 on any H/W Now repeat but power off and on before the VAR RESTORE. Please report both success and any problems Thanks Peter CMM2V5.07.01b1.zip |
||||
Arno Newbie ![]() Joined: 19/09/2020 Location: GermanyPosts: 15 |
Hello Peter, with power on and CPU RESTART everything worked. With power off before VAR RESTORE I get the error message, SAVED VARS CORRUPT - MEMORY CLEARED. Arno EDIT: Direct after power on: > a=10 > var save a This freezes the Maximite G2. Edited 2021-07-13 22:15 by Arno |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10310 |
Arno Thanks for the info. I can fix the lockup but this still leaves us with the issue of why VAR SAVE doesn't work on a very small number of machines. I've posted on the STM forum to see if anyone has any ideas |
||||
Page 1 of 2 ![]() ![]() |
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |