Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 10:30 01 Aug 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 in ERROR command ?

Author Message
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4311
Posted: 11:17pm 16 May 2020
Copy link to clipboard 
Print this post

Hey CMM2 gurus,

Run the attached file on CMM and CMM2.

error_.bas.zip

On CMM output is:

Hello, World
Error: WTF!


On CMM2 output is:

Hello World,
Error: error_.bas


I believe the CMM is correct and the CMM2 is wrong.

I also believe there is some memory corruption problem with Error such that after an Error has been thrown the next invokation of the Editor hangs the system (which requires a reset of the Waveshare) when it tries to Run or Save. This is a heisenbug, it happens consistently when I'm not trying to reproduce it, and not at all when I am !!!

Hope this helps,

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

Joined: 11/12/2012
Location: United Kingdom
Posts: 10310
Posted: 07:29am 17 May 2020
Copy link to clipboard 
Print this post

I didn't even know there was a command ERROR. It certainly hasn't been converted to match the changes in the way MMBasic works on the CMM2 so it is not surprising it doesn't work! Why does it even exist? Clearly none of the development team ever tested it. I'll see what I can do.
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3292
Posted: 09:00am 17 May 2020
Copy link to clipboard 
Print this post

You use it when your program needs to fail gracefully. For example:
IF MM.I2C = 2 THEN ERROR "Cannot find device"


Geoff
Geoff Graham - http://geoffg.net
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4311
Posted: 09:07am 17 May 2020
Copy link to clipboard 
Print this post

I use it all the time in my Zmachine code to "fail early" if a function or subroutine is called with unexpected parameter values. Though for performance reasons I will probably strip most of these checks out for the "release build".

The fact that it has been entirely overlooked gives me some hope it is also the ultimate cause of the regular hanging behaviour I have been observing.

Best wishes,

Tom
MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025