Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 21:28 03 Jul 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 : CMM2: Bug reports

     Page 9 of 17    
Author Message
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4301
Posted: 12:45pm 15 Jun 2020
Copy link to clipboard 
Print this post

BUG: Unexpected ON ERROR SKIP behaviour:

Try this one for size:
Option Explicit On

Dim a
Cls
foo()

Sub foo()
 Print "foo"
 a = 1
 bar()

 ' Should print "1", but instead "Error: A is not declared"
 Print a
End Sub

Sub bar()
 Print "bar"
 On Error Skip 1
 b = 5
 If MM.ERRNO <> 0 Then Print "Error; "; MM.ERRMSG$
 On Error Clear
 If MM.ERRNO = 0 Then Print "Error cleared"
End Sub


Yes, it looks contrived, but it is simplified from a real world case.

Regards,

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

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3282
Posted: 01:11pm 15 Jun 2020
Copy link to clipboard 
Print this post

Hmm, this is one for me.

When I run your code I get:
foo
bar
Error; Function or array $ not declared
Error cleared
1


This output is correct except that the  message is  misleading.  It should say: "Function, variable or array not declared"

This is an easy fix and will be in the next MMBasic release.

Thanks for finding it.
Geoff
Edited 2020-06-15 23:35 by Geoffg
Geoff Graham - http://geoffg.net
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10189
Posted: 01:49pm 15 Jun 2020
Copy link to clipboard 
Print this post

  Quote  Hmm, this is one for me.


Geoff: What did you just test on? On the latest CMM2 code there is an additional bad issue.

UPDATE: found the issue, bloody caching again. Caching and longjmp do not like each other.
Edited 2020-06-16 00:10 by matherp
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10189
Posted: 02:39pm 15 Jun 2020
Copy link to clipboard 
Print this post

V5.05.03b1m

Fixes bugs in ON ERROR SKIP
Improved MM.ERRMSG$ to give the full text of the error with substitutions of data made and file name (if an include file) and linenumber

http://geoffg.net/Downloads/Maximite/CMM2_Beta.zip
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4301
Posted: 03:04pm 15 Jun 2020
Copy link to clipboard 
Print this post

  matherp said  V5.05.03b1m

Fixes bugs in ON ERROR SKIP
Improved MM.ERRMSG$ to give the full text of the error with substitutions of data made and file name (if an include file) and linenumber

http://geoffg.net/Downloads/Maximite/CMM2_Beta.zip


Thank you, that seems to have fixed the real problem too.

  Quote  ... found the issue, bloody caching again. Caching and longjmp do not like each other.


I thought longjmp was goto's evil twin? or is it a necessary evil of programming close to the metal?

Thanks,

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

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3282
Posted: 03:53pm 15 Jun 2020
Copy link to clipboard 
Print this post

  matherp said  Geoff: What did you just test on? On the latest CMM2 code there is an additional bad issue.

Tested on CMM2 V5.05.02 (final)

  thwill said  I thought longjmp was goto's evil twin? or is it a necessary evil of programming close to the metal?

It is dangerous and in C it is rarely needed.  In MMBasic it is used when the interpreter is many functions deep trying to interpret the BASIC program and discovers an error (ie, syntax).  It is not practical to back out of all these functions so a longjump is used to jump to the command prompt and cleanup the C stack at the same time.
Geoff Graham - http://geoffg.net
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3282
Posted: 03:54pm 15 Jun 2020
Copy link to clipboard 
Print this post

  Geoffg said  
  matherp said  Geoff: What did you just test on? On the latest CMM2 code there is an additional bad issue.

Tested on CMM2 V5.05.02 (final).  It is also in the Micromite code and I will fix it there.

  thwill said  I thought longjmp was goto's evil twin? or is it a necessary evil of programming close to the metal?

It is dangerous and in C it is rarely needed.  In MMBasic it is used when the interpreter is many functions deep trying to interpret the BASIC program and discovers an error (ie, syntax).  It is not practical to back out of all these functions so a longjump is used to jump to the command prompt and cleanup the C stack at the same time.

Geoff Graham - http://geoffg.net
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3282
Posted: 03:56pm 15 Jun 2020
Copy link to clipboard 
Print this post

Something strange happened with the last post.  I was trying to say that the bug is also in the Micromite code and I will fix it there.
Geoff Graham - http://geoffg.net
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10189
Posted: 05:01pm 15 Jun 2020
Copy link to clipboard 
Print this post

  Quote  Tested on CMM2 V5.05.02 (final)


That's why some bugs are so difficult to find. There has been absolutely no change in the relevant code since 5.05.02 and yet it behaved exactly like the MM2. A different compilation and some slight change in the combination of caching and longjmp b..g..rs things up
 
MauroXavier
Guru

Joined: 06/03/2016
Location: Brazil
Posts: 303
Posted: 10:43pm 15 Jun 2020
Copy link to clipboard 
Print this post

Peter, in the V5.05.03b1m firmware an old bug has returned...

Now when I make some little changes in my code and when running it, it stills the same as before, like the previous source had cached and the new code is ignored.

Only more significant changes in the source code make the execution right.
 
KeepIS

Guru

Joined: 13/10/2014
Location: Australia
Posts: 1865
Posted: 03:53am 16 Jun 2020
Copy link to clipboard 
Print this post

Small minor note about autosave launched from the command line.

As you type some of the chars are underscored on the VGA display. Not a big deal as it's mostly used for quick file transfers. I occasionally use it from the command line to quickly create a new bas file.

I was wondering how that might look to new users coming across from the Silicon Chip release.

Mike.
NANO Inverter: Full download - Only Hex Ver 8.1Ks
 
Chopperp

Guru

Joined: 03/01/2018
Location: Australia
Posts: 1094
Posted: 04:27am 16 Jun 2020
Copy link to clipboard 
Print this post

Type in OPTION SD TIMING CONSERVATIVE

OPTION LIST says OPTION SD SPEED CONSERVATIVE.
ChopperP
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10189
Posted: 07:14am 16 Jun 2020
Copy link to clipboard 
Print this post

  Quote  As you type some of the chars are underscored on the VGA display.


This is the cursor and shouldn't be showing for autosave - will fix

  Quote  Type in OPTION SD TIMING CONSERVATIVE

OPTION LIST says OPTION SD SPEED CONSERVATIVE.


Will fix

  Quote  Now when I make some little changes in my code and when running it, it stills the same as before, like the previous source had cached and the new code is ignored.


I need an example file and an example edit to diagnose. You have my email address, please send something. This is almost certainly another caching issue as the code can't do what you describe
 
MauroXavier
Guru

Joined: 06/03/2016
Location: Brazil
Posts: 303
Posted: 12:51pm 16 Jun 2020
Copy link to clipboard 
Print this post

  matherp said  I need an example file and an example edit to diagnose. You have my email address, please send something. This is almost certainly another caching issue as the code can't do what you describe


Ok, I will send directly to you soon as possible.

I found a bug in the TEXT command. When I put a transparent setting -1 to the font, the bottom of background was corrupted. Try to load a image and use the TEXT command like this:

TEXT 40,40,"THIS IS A TEST",LT,4,4,RGB(255,255,255),-1

The corruption always occurs from the middle of font to bottom, and if you use the scale, the corruption follows the size too.
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10189
Posted: 01:42pm 16 Jun 2020
Copy link to clipboard 
Print this post

  Quote  I found a bug in the TEXT command. When I put a transparent setting -1 to the font, the bottom of background was corrupted. Try to load a image and use the TEXT command like this:

TEXT 40,40,"THIS IS A TEST",LT,4,4,RGB(255,255,255),-1


I don't see any corruption but you remind me there is a trivial optimisation for outputting transparent test that I've been meaning to make for ages that might solve your issue

I look forward to getting your test files
 
MauroXavier
Guru

Joined: 06/03/2016
Location: Brazil
Posts: 303
Posted: 02:30pm 16 Jun 2020
Copy link to clipboard 
Print this post

When I come back from the job I will send the files.

About the text corruption, for me it occurs exactly this way:

MODE 2,16
PAGE WRITE 2
CLS
LOAD PNG "ANYIMAGE.PNG"
PAGE WRITE 1
CLS
DO WHILE 1=1
PAGE COPY 2 TO 1,I
TEXT 40,40,"THIS IS A TEST",LT,4,4,RGB(255,255,255),-1
PAGE COPY 1 TO 0,I
LOOP

In any case, in the same files that I will send to you I will enable text in a way that will show the bug.
Edited 2020-06-17 00:34 by MauroXavier
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10189
Posted: 02:42pm 16 Jun 2020
Copy link to clipboard 
Print this post

  Quote  About the text corruption, for me it occurs exactly this way:

MODE 2,16
PAGE WRITE 2
CLS
LOAD PNG "ANYIMAGE.PNG"
PAGE WRITE 1
CLS
DO WHILE 1=1
PAGE COPY 2 TO 1,I
TEXT 40,40,"THIS IS A TEST",LT,4,4,RGB(255,255,255),-1
PAGE COPY 1 TO 0,I
LOOP


Now you give me the full information (writing to page 1) I know what the issue is and have fixed it.
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10189
Posted: 02:55pm 16 Jun 2020
Copy link to clipboard 
Print this post

V5.05.03b1n

Fixed a bug in transparent text when writing to a page other than page 0
Improved performance of transparent text output
Added various functions to the list for colour coding in the editor
Corrected the OPTION list text for OPTION SD TIMING CONSERVATIVE
Fixed bug in cursor when typing manually into AUTOSAVE
Flushed caches before doing compare of existing program with edited version
Close all open files after an error

http://geoffg.net/Downloads/Maximite/CMM2_Beta.zip
Edited 2020-06-17 00:58 by matherp
 
MauroXavier
Guru

Joined: 06/03/2016
Location: Brazil
Posts: 303
Posted: 03:56pm 16 Jun 2020
Copy link to clipboard 
Print this post

  matherp said  Flushed caches before doing compare of existing program with edited version


Humm... I will test this version before send the files to you, as this maybe fix my previous issue.

Anxious to back to my home and test it. Thanks for your so fast update!
 
CircuitGizmos

Guru

Joined: 08/09/2011
Location: United States
Posts: 1427
Posted: 06:26pm 16 Jun 2020
Copy link to clipboard 
Print this post

V5.05.03b1n

Option for US keyboard reverts to UK both from the selection of the initial power-on message and also if OPTION USBKEYBOARD US is used.
Micromites and Maximites! - Beginning Maximite
 
     Page 9 of 17    
Print this page
The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025