![]() |
Forum Index : Microcontroller and PC projects : CMM2: Bug reports
![]() ![]() ![]() ![]() |
|||||
Author | Message | ||||
thwill![]() Guru ![]() Joined: 16/09/2019 Location: United KingdomPosts: 4251 |
Also 1. Reset Waveshare 2. CHDIR "subdir" 3. LS "../" - note forward slash - output incorrect, wrong directory and ".." appended to name of current directory: A:/SUBDIR.. 09:47 10-06-2020 5 foo.txt 0 directories, 1 file MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
thwill![]() Guru ![]() Joined: 16/09/2019 Location: United KingdomPosts: 4251 |
BUG: inconsistent behaviour from single-line IF THEN ELSE Try this: Option Explicit On Dim a = 0 Dim b = 0 Dim z = 0 Cls Print "Test 1:" z = 1 ' This prints: ' foo ' bar If z then foo() : bar() Else wombat() Print "Test 2:" z = 0 ' This prints nothing! If z Then foo() : bar() Else wombat() Print "Test 3:" z = 0 ' This prints nothing! If z Then a = a + 4 : b = b + 5 Else wombat() Print "Test 4:" z = 1 ' This reports Error: Expression syntax If z Then a = a + 4 : b = b + 5 Else wombat() Sub foo() Print "foo" End Sub Sub bar() Print "bar" End Sub Sub wombat() Print "wombat" End Sub Now I better do some real work before somebody notices I'm slacking ;-) Tom Edited 2020-06-10 19:21 by thwill MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
thwill![]() Guru ![]() Joined: 16/09/2019 Location: United KingdomPosts: 4251 |
Actually that's wrong. This was late last night whilst I was having a Z-machine hacking session. The editor hung (I think whilst doing an F4 search) and I had to reset. After the reset the filesystem on the SD card was unreadable. Tom MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
Geoffg![]() Guru ![]() Joined: 06/06/2011 Location: AustraliaPosts: 3270 |
The line If z then foo() : bar() Else wombat() is not syntactically correct. It should be: IF condition THEN command ELSE command You cannot have multiple true commands before the ELSE. I will agree that an error should have been raised... but you cannot respond sensibly to every weird construct that users can create. Geoff Geoff Graham - http://geoffg.net |
||||
robert.rozee Guru ![]() Joined: 31/12/2012 Location: New ZealandPosts: 2400 |
from https://docs.microsoft.com/en-us/office/vba/language/reference/user-interface-help/ifthenelse-statement: If condition Then [ statements ] [ Else else statements ] note the "statements" as in plural. however, other sources refer to "statement1" and "statement2" in the singular. mmbasic (including on the MX170) seems to employ a bit of a mixture: For i=0 To 1 Print "example " i+1 If i Then Print ,, "foo ";: Print "bar" Next i For i=0 To 1 Print "example " i+3 If i Then Print ,, "ham" Else Print ,, "eggs" Next i For i=0 To 1 Print "example " i+5 If i Then Print ,, "jam "; Else Print ,, "french ";: Print "toast" Next i > RUN example 1 example 2 foo bar example 3 eggs example 4 ham example 5 french toast example 6 jam toast > so the syntax appears to be: ' simple form, single statement only version of if...then...else if condition then statement1 else statement2 ' where statement1 and statement2 are SINGLE statements or: ' more complex, multiple statements in the then part, NO else if condition then statements ' where statements can be one OR more (colon separated) statements but NOT: ' multiple statements in the then part, ANY sort of else part throws an error if condition then statements else ... ' where statements consist of MORE THAN ONE statement however it is OK for: ' simple form, single statement only version of if...then...else, with other ' UNCONDITIONAL statements following on the SAME LINE if condition then statement1 else statement2 : other_statements ' where statement1 and statement2 are SINGLE statements it really is all quite confusing! i would have said example 1/2 and example 5/6 demonstrate inconsistent behaviour, but a best solution would be for mmbasic to follow the vba syntax. cheers, rob :-) addendum: i was writing the above at the same time that geoff was writing his reply, and only saw his reply after i posted mine. addendum 2: i think a syntax that covers the behaviour of all currently valid cases is: IF condition THEN statement(s) (all statements are conditional) IF condition THEN statement1 ELSE statement2 (statement1 and statement2 can ONLY be SINGLE statements IF condition THEN statement1 ELSE statement2: other-statement(s) (other-statement(s) are unconditionally executed) Edited 2020-06-10 23:25 by robert.rozee |
||||
KeepIS![]() Guru ![]() Joined: 13/10/2014 Location: AustraliaPosts: 1833 |
You don't have to reset it. You could type List Files "/" or "A:/" and everything is fine again, while the CHDIR command does handle ".." it looks like List needs a path back from what it assumes is nowhere. As there is only one drive catered for in the Firmware, the current coding does not care what the drive letter character is (if used), so anything from A to Z is treated as A: I think that could classify as a feature not a bug ![]() . EDIT: Note that List Files default path does not follow a directory change from Chdir or the File manager when it's in that lost state, otherwise it does. . Edited 2020-06-11 08:25 by KeepIS NANO Inverter: Full download - Only Hex Ver 8.1Ks |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10068 |
Sorry been offline for a day or two due to family issues. Lets deal with the easy ones first Will reset the CLUT when entering EDIT or the Filemanager As Geoff says all of the examples are syntactically incorrect but the MMBasic error checking didn't and can't pick up everything without also risking slowing things down too much. The CMM2 code is identical to all other versions of MMBasic and, despite Rob's views, isn't going to change as that could break existing MMBasic programs. The CMM2 will not deviate from other versions of MMBasic in its core interpreter All the directory related issues are the same. FatFS does not support relative addressing for exFAT volumes. To get round this I tried to code for this in the CMM2 firmware but clearly this isn't perfect. I will try and fix the issues raised but ultimately there may be only one of two solutions available 1: drop exFAT support 2: drop relative addressing support My biggest concern is the editor issue and unfortunately the reports give me nothing to go on. Please report everything about your usage when you see this. e.g. Does it only happen after running the program Did the program end normally or error or Ctrl-C If error was it in main code or a subroutine Anything and every little thing that just may be relevant, any non-standard options set etc. |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10068 |
More on file issues: Lets sort the wheat from the chaff: CWD$ - this is a simple bug and will be fixed Other: There was a request that list files could include a directory specification. I included this but it looks like it was a mistake to do so. however, we can try and analyse if it can stay. This is correct. The firmware is looking for a file named ".." This is also correct. The firmware is looking for a file named "." The file match cannot know that it includes a directory specification unless there is a "\" or a "/" otherwise the string is treated as just a filename. To do anything else would require lots of special case which isn't sensible (..fname, fname.. etc.) Of course the match of "." or ".." shouldn't cause a problem for a subsequent match. That is definitely a bug. If we continue to allow a pathname then that needs fixing but this needs a significant change to implement relative addressing in LS. I'll look at it. |
||||
thwill![]() Guru ![]() Joined: 16/09/2019 Location: United KingdomPosts: 4251 |
Thanks Peter. MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10068 |
Please download V5.05.03b1c from http://geoffg.net/Downloads/Maximite/CMM2_Beta.zip V5.05.03b1c Added German keyboard support - use OPTION USBKEYBOARD DE Fixed bug in function CWD$ Fixed bugs in relative pathnames in LS / LIST FILES Re-engineered relative pathnames for all file-opening commands to improve exFAT compatibility Made a change that "may" ameliorate a non-replicable bug in cut and paste functionality Reset colour mapping when entering editor or filemanager Edited 2020-06-12 01:14 by matherp |
||||
Chopperp![]() Guru ![]() Joined: 03/01/2018 Location: AustraliaPosts: 1090 |
Quick question. Typing OPTION LIST before the upgrade I get OPTION DISPLAY 50,100 I can't find OPTION DISPLAY anywhere in the manual. Renamed the same after the upgrade ChopperP |
||||
vegipete![]() Guru ![]() Joined: 29/01/2013 Location: CanadaPosts: 1122 |
Very minor detail: in the editor, [END][END] goes to the _beginning_ of the last line. To get to the end of the last line, you then need to arrow up, arrow down and press [END] one time more. Latest version V5.05.03b1c is otherwise behaving nicely so far. Could the auto-repeat rate be sped up? Or an option to make it user setable? ========================================================= Crikey, this thing is way faster than my Apple//gs. Visit Vegipete's *Mite Library for cool programs. |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6220 |
OPTION DISPLAY is read only (as a reminder to set your terminal appropriately) Jim VK7JH MMedit |
||||
KeepIS![]() Guru ![]() Joined: 13/10/2014 Location: AustraliaPosts: 1833 |
CMM2V5.05.03b1c Program is 56 lines long. Only option change is keyboard to US. Editing from the USB keyboard. Nothing connected to Serial. Sorry for the long disjointed Post, but I wanted to include everything I did as I went along. Part 1: Edit program, cut past a line or two for a few minutes, all good. Run & edit cycle still good. Break out of program with Ctrl-C. First copy and paste and nothing pasted. Tried again, nothing pasted. 3rd time copy and paste and it pasted @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ in black with white background. I delete the line of @ chars and the line is now clear. I press F5 to paste again and I get the same long line of @ I move the cursor to the line of code below the line of @@@@@ and press enter. A new blank line appears and the cursor follows the line of code which is now below the blank line. But now the line of code after the cursor has somehow been copied and inserted at the beginning of the line of @@@@@. If I move the cursor above the line of @@@@@ and press enter, the ESC sequence ?[?255l?[HMJMJMJMJM now appears in the line below. PressF1 to save and go back to EDIT and: The line of @@@@@@@@@@@ is gone and the inserted code at the start is still there. The ESC sequence has trimmed to ?[?25l?[H and around 5 blank lines have been inserted below that. I can now delete the rogue text and edit normally. Part 2 I run the program again and press Ctrl-C and because I release the Ctrl key a fraction before the "C", I'm left with a c on the line, leave it there and type edit after it and purposely cause an error. Type edit and immediately select a line of code, copy and paste, I get an ESC seq ?[?25l?[H I can delete that and edit again. Part 3: Run the program, Ctrl-C, Type Edit. Press F4 and highlight two short lines of code. Mover the cursor up 10 lines and press enter to make room for the insert. The instant I pressed Enter to make room, the ESC code ?[?255l?[HMJMJMJMJM is inserted. I move the cursor down to the next line and press enter and the ESC code above changes to @@@@@@@@@@@@@@@@@@@@. The editor is now completely unusable with @@@@@ and ESC codes getting inserted and replacing the lines of code. I will no longer post what happens in the editor: I will attempt to look for a pattern that might be causing this. I'm surprised that only one other user has reported this? It makes me wonder about hardware instability, however I've left programs running all day for the past week, have been sending and saving 280Kb programs to the CMM2 from my windows Control program in around 12 seconds and reading back, not once has there been an error. The SD is ROCK solid, everything just works perfectly, until I try to Edit. Sometimes it's good, but soon starts this rogue behaviour. . . Edited 2020-06-12 09:44 by KeepIS NANO Inverter: Full download - Only Hex Ver 8.1Ks |
||||
vegipete![]() Guru ![]() Joined: 29/01/2013 Location: CanadaPosts: 1122 |
Does the RESTORE command work as expected and as desired? RESTORE thislabel works fine.there$ = "thislabel" does not work.RESTORE there$ Why am I trying to do this? I want to restart a level. Data for each level appears after a label "Level<X>:" where <X> is of course the level number. I hope I don't have to use a monster SELECT CASE to get the desired restore label for each level. Visit Vegipete's *Mite Library for cool programs. |
||||
vegipete![]() Guru ![]() Joined: 29/01/2013 Location: CanadaPosts: 1122 |
Playing with the editor and getting strangeness. But a bit different this time. Selecting, copying and pasting. CTRL-S,C,V behaviour doesn't appear different from F4, F5 (Latest firmware, US USB keyboard, no console.) This time, pasting appeared to insert unexpected blank lines that mis-align the cursor from the text. Then, turning on select mode made lines higher up from the cursor appear, replacing the actual line being selected. The number of lines higher is the number of blank lines that were pasted before. But it took a bunch of selecting, pasting and deleting before it stated happening. Testing continues... Visit Vegipete's *Mite Library for cool programs. |
||||
KeepIS![]() Guru ![]() Joined: 13/10/2014 Location: AustraliaPosts: 1833 |
Thanks vegipete, yes I'm starting to doubt my unit, even though everything is working perfectly in every other way. I decided to remeasure the supply at the board and found it to be 4.85v running from the NUC-PC port. For a test, I connected the 5v input to my Lab supply and ran it at 4.5v and then down to 4.00v, everything was still perfect, I'm guessing that the only things using the 5v input are the USB keyboard, and in my case, the USB to Serial device, the rest running from the boards 3v3 reg. Anyhow, nothing I did would cause an error, so the supply is not the problem. I reconnected to the USB port, back running @ 4.86v and the Editor has decided to run perfectly once again. ![]() This is just plain stupid, I really feel for Peter, I assume he still has some hair left? I've a bit of coding to do today, so it'll do everything from the CMM2 itself and see what happens. Mike. NANO Inverter: Full download - Only Hex Ver 8.1Ks |
||||
KeepIS![]() Guru ![]() Joined: 13/10/2014 Location: AustraliaPosts: 1833 |
I was editing fine, typed in some code, copy paste and finally copy and inserting a change of label name, pasted a few (same paste) and on the last paste got a line of "e" across and off the screen, code was hidden (scrolled off?) and I lost every change I had made. ![]() I must start using Ctrl-W, but having to enter a name each time is a pain, it would be nice if it remembered the last name used in the current editing session once Ctrl-W is used the first time. NANO Inverter: Full download - Only Hex Ver 8.1Ks |
||||
vegipete![]() Guru ![]() Joined: 29/01/2013 Location: CanadaPosts: 1122 |
I hand recorded a page of my keystrokes - and nothing went wrong. Went and researched USB keystroke loggers - might have to get me one. Came back again and started more testing - and got some weirdness. I think I have spotted something... minor? If you turn on MARK and arrow down to a blank line (that means, the cursor is at horizontal position 1 and the line above has text) and copy, subsequent pasting adds an extra blank line. There is something strange about these blank lines. After lots of copying, pasting, deleting and arrowing up and down past these blank lines, something starts to go haywire. But I still haven't got a specific sequence that causes the problem. Visit Vegipete's *Mite Library for cool programs. |
||||
vegipete![]() Guru ![]() Joined: 29/01/2013 Location: CanadaPosts: 1122 |
OK, that's weird. I just tried CTRL-W, typed "errbak", hit [ENTER] and watched [ENTER] auto-repeat down the screen after the save completed. Pressed any key to stop the auto-repeat. The same is happening now every time I type do a CTRL-W save, same or different file names. Triple [ESC] to exit the editor, and the file seems to be gone. The backups are there. Hmmm.... Rename a backup with .bas type, edit it and the same auto-repeating enter key thing is still happening. Beats me. I'm gonna go eat some dinner. Visit Vegipete's *Mite Library for cool programs. |
||||
![]() ![]() ![]() ![]() |
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |